File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change
1
+ // set stored theme
2
+ let mode = localStorage . getItem ( 'mode' ) ;
3
+ if ( mode === "light" ) {
4
+ $ ( 'body' ) . addClass ( 'night' ) ;
5
+ $ ( '#toggle-box-checkbox' ) . prop ( 'checked' , true ) ;
6
+ }
7
+
1
8
function init ( ) {
2
9
const contributionsDisplay = document . getElementById ( 'contributions-number' )
3
10
const displayClass = document . getElementById ( 'contributions-number' ) . classList
@@ -57,19 +64,14 @@ function init() {
57
64
// night mode feature
58
65
$ ( '#toggle-box-checkbox' ) . on ( 'change' , function ( ) {
59
66
localStorage . setItem ( 'mode' , this . checked ? "light" : "dark" ) ;
67
+ $ ( 'body' ) . removeClass ( 'no-transition' ) ;
60
68
if ( this . checked ) {
61
69
$ ( 'body' ) . addClass ( 'night' )
62
70
} else {
63
71
$ ( 'body' ) . removeClass ( 'night' )
64
72
}
65
73
} ) ;
66
74
67
- // set stored theme
68
- let mode = localStorage . getItem ( 'mode' ) ;
69
- if ( mode === "light" ) {
70
- $ ( '#toggle-box-checkbox' ) . click ( ) ;
71
- }
72
-
73
75
function demo ( ) {
74
76
setInterval ( function ( ) {
75
77
$ ( '#toggle-box-checkbox' ) . trigger ( 'click' )
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ body {
34
34
font-family : roboto, arial, sans-serif;
35
35
}
36
36
37
+ body .no-transition , body .no-transition * {
38
+ transition : none !important ;
39
+ }
40
+
37
41
header {
38
42
margin : 10px auto 20px auto;
39
43
text-align : left;
Original file line number Diff line number Diff line change 14
14
< title > Resource Card</ title >
15
15
</ head >
16
16
17
- < body >
17
+ < body class =" no-transition " >
18
18
< div class ="container ">
19
19
< div class ="row ">
20
20
< div class ="column ">
You can’t perform that action at this time.
0 commit comments