-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
35 lines (29 loc) · 973 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
function toggleNavbox() {
const navmenu = document.getElementById("navmenu");
if (navmenu.style.display === "flex") {
navmenu.style.display = "none";
} else {
navmenu.style.display = "flex";
}
}
window.addEventListener("resize", () => {
const navmenu = document.getElementById("navmenu");
if (window.innerWidth >= 650) {
navmenu.style.display = "flex";
} else {
navmenu.style.display = "none";
}
});
document.addEventListener("DOMContentLoaded", () => {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("in-view");
} else {
entry.target.classList.remove("in-view");
}
});
});
const allAnimatedElements = document.querySelectorAll('.animate');
allAnimatedElements.forEach((element) => observer.observe(element));
});