-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
32 lines (26 loc) · 807 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
const header = document.querySelector("header");
window.addEventListener("scroll",function(){
header.classList.toggle("sticky",window.scrollY > 10)
});
let menu = document.querySelector('#menu-icon');
let navlist = document.querySelector('.navlist');
menu.onclick = () => {
menu.classList.toggle('bx-x');
navlist.classList.toggle('open');
};
window.onscroll = () => {
menu.classList.remove('bx-x');
navlist.classList.remove('open');
};
function themeFunction(theme){
var element = document.body;
element.classList.toggle("light-mode")
if(!theme.className.includes("bxs-moon")){
theme.classList.toggle("bxs-moon")
theme.classList.remove("bxs-sun")
}
else{
theme.classList.add("bxs-sun")
theme.classList.remove("bxs-moon")
}
}