-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
28 lines (25 loc) · 888 Bytes
/
script.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
// Settings Menu Toggle
var settingsmenu = document.querySelector(".settings-menu");
function settingsMenuToggle() {
settingsmenu.classList.toggle("settings-menu-height");
}
// Dark Button Toggle
var darkBtn = document.getElementById("dark-btn");
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");
darkBtn.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");
}