-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (42 loc) · 1.33 KB
/
script.js
File metadata and controls
46 lines (42 loc) · 1.33 KB
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
// function imgSlider(anything){
// document.querySelector('.starbucks').src = anything;
// }
// let but=document.querySelector(".clickme");
// let body=document.querySelector("body");
// let currentMode="light";
// but.addEventListener("click",()=>{
// if(currentMode==="light"){
// currentMode="dark";
// body.classList.add("dark");
// body.classList.remove("light");
// }
// else{
// currentMode="light";
// body.classList.add("light");
// body.classList.remove("dark");
// }
// });
function imgSlider(anything){
document.querySelector('.cycles').src = anything;
}
let but=document.querySelector(".clickme");
let body=document.querySelector("body");
let currentMode="light";
but.addEventListener("click",()=>{
if(currentMode==="light"){
currentMode="dark";
body.classList.add("dark");
body.classList.remove("light");
var btn=document.getElementById("btn");
btn.classList.add("btn-dark");
btn.classList.remove("btn-light");
}
else{
currentMode="light";
body.classList.add("light");
body.classList.remove("dark");
var btn=document.getElementById("btn");
btn.classList.add("btn-light");
btn.classList.remove("btn-dark");
}
});