-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
38 lines (30 loc) · 932 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
36
37
38
const header = document.querySelector("header");
window.addEventListener("scroll", function () {
header.classList.toggle("sticky", window.scrollY > 0);
});
let menu = document.querySelector("#menu-icon");
let navbar = document.querySelector(".navbar");
menu.onclick = () => {
menu.classList.toggle("bx-x");
navbar.classList.toggle("open");
};
window.onscroll = () => {
menu.classList.remove("bx-x");
navbar.classList.remove("open");
};
const sr = ScrollReveal({
distance: "30px",
duration: 2500,
reset: true,
});
sr.reveal(".home-text", { delay: 200, origin: "left" });
sr.reveal(".home-img", { delay: 200, origin: "right" });
sr.reveal(".container, .about, .menu, .contact, .footer", {
delay: 200,
origin: "bottom",
});
const iconBtn = document.querySelector(".bx-sun");
const toggleBtn = () => {
document.body.classList.toggle("light-theme");
};
iconBtn.addEventListener("click", () => toggleBtn());