generated from microverseinc/readme-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.js
23 lines (20 loc) · 826 Bytes
/
menu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const hamburger = document.querySelector('.hamburger');
const navMenu = document.querySelector('.ul-nav');
const logo = document.querySelector('.nav-logo-link');
const bars = document.querySelector('.bars');
hamburger.addEventListener('click', () => {
hamburger.classList.toggle('active');
navMenu.classList.toggle('active');
logo.classList.toggle('active');
bars.classList.toggle('active');
});
document.querySelectorAll('.nav-link').forEach((n) => n.addEventListener('click', () => {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
logo.classList.remove('active');
}));
document.querySelectorAll('.close-button').forEach((n) => n.addEventListener('click', () => {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
logo.classList.remove('active');
}));