h
This commit is contained in:
parent
00e202978d
commit
351773a8aa
7 changed files with 12 additions and 10 deletions
|
@ -15,7 +15,7 @@ let scheme = window.matchMedia(`(prefers-color-scheme: dark)`);
|
|||
let theme = window.localStorage.getItem('prefer-light');
|
||||
let title = document.getElementsByClassName('title')[0];
|
||||
let body = document.getElementsByTagName('body')[0];
|
||||
|
||||
let toggle = document.getElementById('theme-switch');
|
||||
if (theme === 'yes') {
|
||||
body.classList.add('light');
|
||||
} else if (theme === 'no') {
|
||||
|
@ -31,7 +31,8 @@ if (theme === 'yes') {
|
|||
}
|
||||
}
|
||||
|
||||
title.addEventListener('click', (e) => {
|
||||
/* toggle.addEventListener('click', (e) => {
|
||||
console.log(e);
|
||||
body.classList.toggle('light');
|
||||
if (body.classList.contains('light')) {
|
||||
window.localStorage.setItem('prefer-light', 'yes');
|
||||
|
@ -41,3 +42,4 @@ title.addEventListener('click', (e) => {
|
|||
console.log('user likes dark');
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue