-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
37 lines (33 loc) · 1.14 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
const menuIcon = document.querySelector('.navbar-icon');
const menu = document.querySelector('.menu');
const toggleNavbar = document.querySelector('.navbar');
const toggleSocials = document.querySelector('.socials');
const body = document.querySelector('.body');
const menuItem = document.querySelectorAll('#menu');
const download = document.querySelectorAll('.download');
const toggleMenu = () => {
menu.classList.toggle('d-none');
menuIcon.classList.toggle('toggle-navbar-icon');
menu.classList.toggle('toggle-menu');
toggleNavbar.classList.toggle('toggle-navbar');
toggleSocials.classList.toggle('toggle-socials');
controlOverflow();
};
const controlOverflow = () => {
if (menu.classList.contains('toggle-menu')) {
body.classList.add('lockScroll');
} else body.classList.remove('lockScroll');
};
menuIcon.addEventListener('click', toggleMenu);
menuItem.forEach((item) => {
item.addEventListener('click', (event) => {
if (menu.classList.contains('toggle-menu')) {
toggleMenu();
}
});
});
download.forEach((item) => {
item.addEventListener('click', () => {
window.open('./assets/giovanna-aveiro_cv.pdf');
});
});