|
4 | 4 | const openMenu = document.querySelector(".menu-open-icon");
|
5 | 5 | const closeMenu = document.querySelector(".menu-close-icon");
|
6 | 6 | const navBar = document.querySelector("nav");
|
7 |
| - const dropDownContainers = document.querySelectorAll("header nav ul li a"); |
8 |
| - const dropDowns = document.querySelectorAll("header nav ul li ul"); |
9 |
| - const dropdownArrows = document.querySelectorAll(".changeImg"); |
10 |
| - |
11 |
| - |
12 |
| - |
13 |
| - |
14 |
| -// // Handles the dropdowns |
15 |
| -// dropDownContainers.forEach((dropDownContainer, index) => { |
16 |
| -// // Function to close all dropdowns and open the selected one |
17 |
| -// const toggleDropdown = () => { |
18 |
| -// dropDowns.forEach((dropdown, i) => { |
19 |
| -// if (i !== index) { |
20 |
| -// dropdown.classList.add("drop"); |
21 |
| -// dropdownArrows[i].src = "./images/icon-arrow-down.svg"; |
22 |
| -// } |
23 |
| -// }); |
24 |
| - |
25 |
| -// dropDowns[index].classList.toggle("drop"); |
26 |
| - |
27 |
| -// if (dropDowns[index].classList.contains("drop")) { |
28 |
| -// dropdownArrows[index].src = "./images/icon-arrow-down.svg"; |
29 |
| -// } else { |
30 |
| -// dropdownArrows[index].src = "./images/icon-arrow-up.svg"; |
31 |
| -// } |
32 |
| -// }; |
33 |
| - |
34 |
| -// // Toggle on mouse enter |
35 |
| -// dropDownContainer.addEventListener("mouseenter", toggleDropdown); |
36 |
| - |
37 |
| -// // Toggle on focus |
38 |
| -// dropDownContainer.addEventListener("focus", toggleDropdown); |
39 |
| - |
40 |
| -// // Toggle on mouse leave |
41 |
| -// dropDownContainer.addEventListener("mouseleave", () => { |
42 |
| -// if (!dropDownContainer.matches(":focus")) { |
43 |
| -// toggleDropdown(); |
44 |
| -// } |
45 |
| -// }); |
46 |
| - |
47 |
| -// // Toggle on blur |
48 |
| -// dropDownContainer.addEventListener("blur", () => { |
49 |
| -// if (!dropDownContainer.matches(":hover")) { |
50 |
| -// toggleDropdown(); |
51 |
| -// } |
52 |
| -// }); |
53 |
| - |
54 |
| - |
55 |
| -// // dropDownContainer.addEventListener("mouseenter", () => { |
56 |
| -// // // Toggle the 'drop' class on mouse enter |
57 |
| -// // dropDowns[index].classList.toggle("drop"); |
58 |
| - |
59 |
| -// // // Change the dropdown arrow image on mouse enter |
60 |
| -// // if (dropDowns[index].classList.contains("drop")) { |
61 |
| -// // dropdownArrows[index].src = "./images/icon-arrow-down.svg"; |
62 |
| -// // } else { |
63 |
| -// // dropdownArrows[index].src = "./images/icon-arrow-up.svg"; |
64 |
| -// // } |
65 |
| -// // }); |
66 |
| - |
67 |
| -// // dropDownContainer.addEventListener("mouseleave", () => { |
68 |
| -// // // Toggle the 'drop' class on mouse leave |
69 |
| -// // dropDowns[index].classList.toggle("drop"); |
70 |
| - |
71 |
| -// // // Change the dropdown arrow image back to the original on mouse leave |
72 |
| -// // if (dropDowns[index].classList.contains("drop")) { |
73 |
| -// // dropdownArrows[index].src = "./images/icon-arrow-down.svg"; |
74 |
| -// // } else { |
75 |
| -// // dropdownArrows[index].src = "./images/icon-arrow-up.svg"; |
76 |
| -// // } |
77 |
| -// }); |
78 |
| - |
79 | 7 |
|
80 | 8 | // Handles the handburger menus and the navbar
|
81 | 9 | openMenu.addEventListener("click", () => {
|
|
0 commit comments