-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (27 loc) · 978 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
29
30
31
32
33
34
35
// Typing Animation //
var typed = new Typed(".typing",{
strings: ["","Web Developer", "", "Web Designer", "", "Graphic Designer", "", "Forex Trader", "", "Crypto Dealer", "Book Writer", "Business Coach"],
typeSpeed:100,
BackSpeed:60,
loop:true
})
const body = document.querySelector('body'),
sidebar = body.querySelector('nav'),
toggle = body.querySelector(".toggle"),
searchBtn = body.querySelector(".search-box"),
modeSwitch = body.querySelector(".toggle-switch"),
modeText = body.querySelector(".mode-text");
toggle.addEventListener("click" , () =>{
sidebar.classList.toggle("close");
})
searchBtn.addEventListener("click" , () =>{
sidebar.classList.remove("close");
})
modeSwitch.addEventListener("click" , () =>{
body.classList.toggle("dark");
if(body.classList.contains("dark")){
modeText.innerText = "Light mode";
}else{
modeText.innerText = "Dark mode";
}
});