-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (20 loc) · 695 Bytes
/
Copy pathscript.js
File metadata and controls
24 lines (20 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function toggleMenu() {
const menu = document.querySelector(".menu-links");
const icon = document.querySelector(".hamburger-icon");
menu.classList.toggle("open");
icon.classList.toggle("open");
}
document.addEventListener("DOMContentLoaded", function () {
const sections = document.querySelectorAll(".section");
window.addEventListener("scroll", function () {
const scrollPosition = window.scrollY + window.innerHeight * 0.6;
sections.forEach((section) => {
const sectionTop = section.offsetTop;
if (scrollPosition > sectionTop) {
section.classList.add("visible");
} else {
section.classList.remove("visible");
}
});
});
});