-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (27 loc) · 961 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
26
27
28
29
30
31
32
33
34
35
36
37
38
const modal = document.querySelector('#modal-menu');
// Target the hamburger menu
const hamburger = document.querySelector('.hamburger-btn');
// Target the close btn
const closeBtn = document.querySelector('.modal-header');
// Target the portfolio menu
const portfolio = document.querySelector('.modal-portfolio');
// Target the about menu
const about = document.querySelector('.modal-about');
// Target the contact menu
const contact = document.querySelector('.modal-contact');
// Funtion to display the menu
function display() {
modal.style.display = 'flex';
}
// Funtion to hide the menu
function hide() {
modal.style.display = 'none';
}
// Add event on the hamburger btn
hamburger.addEventListener('click', display);
// Add event on the close btn
closeBtn.addEventListener('click', hide);
// Add event on the portfolio
portfolio.addEventListener('click', hide);
about.addEventListener('click', hide);
contact.addEventListener('click', hide);