mirror of
https://github.com/jakejarvis/dark-mode-example.git
synced 2026-09-11 23:25:34 -04:00
Update dark-mode.js
This commit is contained in:
+4
-4
@@ -67,12 +67,12 @@
|
|||||||
// handle toggle click
|
// handle toggle click
|
||||||
toggle.addEventListener('click', function () {
|
toggle.addEventListener('click', function () {
|
||||||
// switch to the opposite theme & save preference in local storage
|
// switch to the opposite theme & save preference in local storage
|
||||||
if (!active) {
|
if (active) {
|
||||||
activateTheme(dark);
|
|
||||||
storage.setItem(pref_key, dark);
|
|
||||||
} else {
|
|
||||||
activateTheme(light);
|
activateTheme(light);
|
||||||
storage.setItem(pref_key, light);
|
storage.setItem(pref_key, light);
|
||||||
|
} else {
|
||||||
|
activateTheme(dark);
|
||||||
|
storage.setItem(pref_key, dark);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user