-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (22 loc) · 885 Bytes
/
index.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
let menuIcon = document.querySelector(".menu-icon");
let navlist = document.querySelector(".navlist")
menuIcon.addEventListener("click", () => {
menuIcon.classList.toggle("active");
navlist.classList.toggle("active");
document.body.classList.toggle("open");
});
navlist.addEventListener("click", () => {
navlist.classList.remove("active");
menuIcon.classList.remove("active");
document.body.classList.remove("open");
})
const buttons = document.querySelectorAll('.about-btn button');
const contents = document.querySelectorAll('.content');
buttons.forEach((button, index) => {
button.addEventListener('click', () => {
contents.forEach(content => content.style.display = 'none');
contents[index].style.display = 'block';
buttons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
});
});