-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
37 lines (31 loc) · 1.05 KB
/
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
29
30
31
32
33
34
35
36
37
//dark mode
function darkMode() {
let checkBox =document.getElementById("checkbox")
let element = document.body;
let header = document.getElementById("headOfSite");
if (checkBox.checked)
{
element.style.backgroundColor="#121212";
element.style.color="white";
header.style.backgroundColor="#121212";
}
else {
element.style.backgroundColor="white";
element.style.color="black";
header.style.backgroundColor="white";
}
}
function light() {
let header = document.getElementById("headOfSite");
header.classList.toggle("dark-mode");
let element = document.body;
element.classList.toggle("dark-mode");
}
//ScrollBar function
window.onscroll = function() {progressBar()};
function progressBar() {
let winScroll = document.body.scrollTop || document.documentElement.scrollTop;
let height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
let scrolled = (winScroll / height) * 100;
document.getElementById("myBar").style.height = scrolled + "%";
}