-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
38 lines (31 loc) · 1.15 KB
/
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
36
37
38
const hamburger = document.getElementById('hamburger');
const closeIcon = document.getElementById('close-icon-btn');
const mobileMenu = document.getElementById('mobile-menu');
const mobileList = document.getElementById('mobile-menu-list');
const modals = document.querySelectorAll('.popup');
const projectButtons = document.querySelectorAll('.project-button');
const closeBtn = document.querySelectorAll('.close-btn');
hamburger.addEventListener('click', () => {
mobileMenu.style.display = 'block';
});
closeIcon.addEventListener('click', () => {
mobileMenu.style.display = 'none';
});
mobileList.addEventListener('click', () => {
mobileMenu.style.display = 'none';
});
for (let i = 0; i < projectButtons.length; i += 1) {
projectButtons[i].addEventListener('click', () => {
const modal = document.querySelector(projectButtons[i].getAttribute('data-target'));
modal.style.display = 'block';
});
}
for (let i = 0; i < closeBtn.length; i += 1) {
closeBtn[i].addEventListener('click', () => {
for (let j = 0; j < modals.length; j += 1) {
if (modals[j].style.display === 'block') {
modals[j].style.display = 'none';
}
}
});
}