-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
47 lines (31 loc) · 1.1 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
38
39
40
41
42
43
44
45
46
47
let darkMode = false;
function changeDarkMode() {
if (darkMode) {
darkMode = false;
document.documentElement.style.setProperty("--text-color", "black");
document.documentElement.style.setProperty("--background-color", "#efe7e5");
document.getElementById("dark-light-mode").innerHTML = "Mode Sombre";
document.getElementById("light-mode").innerHTML="dark_mode"
} else {
darkMode = true
document.documentElement.style.setProperty("--text-color", "white");
document.documentElement.style.setProperty("--background-color", "black");
document.getElementById("dark-light-mode").innerHTML = "Mode Clair";
document.getElementById("light-mode").innerHTML="light_mode"
}
}
const goTopBtn = document.querySelector('.go-top-btn');
window.addEventListener('scroll', checkHeight)
function checkHeight(){
if(window.scrollY > 200) {
goTopBtn.style.display = "flex"
} else {
goTopBtn.style.display = "none"
}
}
goTopBtn.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: "smooth"
})
})