1
mirror of https://github.com/jakejarvis/dark-mode-example.git synced 2025-10-18 22:04:25 -04:00

Update dark-mode.js

This commit is contained in:
2020-05-04 12:49:06 -04:00
committed by GitHub
parent 4a36b8c526
commit 7d8aa59530

View File

@@ -67,12 +67,12 @@
// handle toggle click
toggle.addEventListener('click', function () {
// switch to the opposite theme & save preference in local storage
if (!active) {
activateTheme(dark);
storage.setItem(pref_key, dark);
} else {
if (active) {
activateTheme(light);
storage.setItem(pref_key, light);
} else {
activateTheme(dark);
storage.setItem(pref_key, dark);
}
}, true);
}