This repository was archived by the owner on Apr 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
47 lines (40 loc) · 1.35 KB
/
script.js
File metadata and controls
47 lines (40 loc) · 1.35 KB
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
39
40
41
42
43
44
45
46
47
const nav = document.querySelector(".nav");
const closeIcon = document.querySelector(".close");
const menuIcon = document.querySelector(".menuIcon");
const details = document.querySelectorAll(".details");
const arrows = document.querySelectorAll(".arrow");
for (let cont = 0; cont < details.length; cont++) {
details[cont].addEventListener("click", ()=>{
if (!details[cont].hasAttribute("open")){
arrows[cont].src = "./images/icon-arrow-up.svg";
}
else {
arrows[cont].src = "./images/icon-arrow-down.svg";
}
})
}
/************************************* Movil Events ********************************************** */
menuIcon.addEventListener("click", ()=>{
nav.classList.remove("none");
setTimeout(()=>{
nav.setAttribute('style', 'margin: 0 0%;');
},250);
});
closeIcon.addEventListener("click", ()=>{
nav.setAttribute('style', 'margin: 0 110%;');
setTimeout(()=>{
nav.classList.add("none");
},800);
});
function deleteNone() { //detect screen and relocate menu
const windowOb = window;
const windowValue = windowOb.innerWidth;
if (windowValue > 930) {
nav.classList.remove('none');
nav.setAttribute('style', 'margin: 0 0%;');
} else {
nav.classList.add('none');
}
}
window.addEventListener('resize',deleteNone);
deleteNone();