-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
29 lines (26 loc) · 831 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var settingsmenu = document.querySelector('.settings-menu');
var darkBtn = document.getElementById('dark-btn');
function settingsMenuToggle() {
settingsmenu.classList.toggle('settings-menu-height');
}
darkBtn.onclick = function(){
darkBtn.classList.toggle('dark-btn-on');
document.body.classList.toggle("dark-theme");
if(localStorage.getItem("theme")=="light"){
localStorage.setItem("theme", "dark");
}
else{
localStorage.setItem("theme", "light");
}
}
if(localStorage.getItem("theme")=="light"){
darkBtn.classList.remove("dark-btn-on");
document.body.classList.remove("dark-theme");
}
else if(localStorage.getItem("theme")=="dark"){
darkBtn.classList.add("dark-btn-on");
document.body.classList.add("dark-theme");
}
else{
localStorage.setItem("theme", "light");
}