-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
28 lines (22 loc) · 938 Bytes
/
script.js
File metadata and controls
28 lines (22 loc) · 938 Bytes
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
let toggle_btn = document.getElementById("toggle-btn");
let toggle = document.getElementById("toggle");
let body = document.body;
// --------------------------------------------------------------------------------------------------
let light_mode = true;
// --------------------------------------------------------------------------------------------------
toggle_btn.addEventListener("click", () => {
if (light_mode === true) {
body.style.backgroundColor = "black";
toggle_btn.style.backgroundColor = "white";
toggle.style.backgroundColor = "black";
toggle_btn.style.justifyContent = "end";
light_mode = false;
}
else {
body.style.backgroundColor = "white";
toggle_btn.style.backgroundColor = "black";
toggle.style.backgroundColor = "white";
toggle_btn.style.justifyContent = "start";
light_mode = true;
}
})