-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
52 lines (45 loc) · 1.7 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const navLogo = document.querySelector("#nav-logo");
const mobileMenu = document.querySelector("#mobile-menu");
const closingX = document.querySelector("#closing-x");
const navLinkArrow = document.querySelectorAll("#nav-link-arrow");
const dropdownContainer = document.querySelectorAll("#dropdown-container");
const headerContainer = document.querySelector("#header-container");
const main = document.querySelector("main");
const heartIcon = document.querySelectorAll("#heart-icon");
const arrowBack = document.querySelectorAll("#arrow-back");
const footer = document.querySelector("footer");
// for mobile menu
navLogo.addEventListener("click", () => {
mobileMenu.style.display = "flex";
headerContainer.style.display = "none";
main.style.display = "none";
footer.style.display = "none";
})
closingX.addEventListener ("click", () => {
mobileMenu.style.display = "none";
headerContainer.style.display = "flex";
main.style.display = "flex";
footer.style.display = "flex";
})
navLinkArrow.forEach(arrow => {
arrow.addEventListener("click", () => {
const thisDropdown = arrow.nextElementSibling;
if (arrow.src.endsWith("assets/triangle-down.svg")) {
arrow.src = "assets/triangle-up.svg";
thisDropdown.style.display = "flex";
} else {
arrow.src = "assets/triangle-down.svg";
thisDropdown.style.display = "none";
}
})
})
// for home page
heartIcon.forEach(icon => {
icon.addEventListener("click", () => {
if (icon.src.endsWith("assets/heart-outline.svg")) {
icon.src = "assets/heart.svg"
} else {
icon.src = "assets/heart-outline.svg"
}
})
})