-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
60 lines (51 loc) · 1.81 KB
/
index.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
53
54
55
56
57
58
59
60
// Header
const navbarBurger = document.getElementById("navbar-burger");
const navbarCross = document.getElementById("navbar-cross");
const navbarContentDropdown = document.querySelectorAll(
".navbar-content-dropdown"
);
const openMenu = () => {
navbarBurger.classList.replace("mobile-display", "hide");
navbarCross.classList.remove("hide");
navbarContentDropdown[0].classList.remove("hide");
};
const closeMenu = () => {
navbarBurger.classList.replace("hide", "mobile-display");
navbarCross.classList.add("hide");
navbarContentDropdown[0].classList.add("hide");
};
// Slider
let slideIndex;
const slides = document.querySelectorAll(".slide");
const dots = document.querySelectorAll(".dot");
const showSlide = (slideIndex) => {
slides.forEach((slide) => {
slide.style.display = "none";
});
dots.forEach((dot) => {
dot.style.backgroundColor = "#bbb";
});
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].style.backgroundColor = "grey";
};
// Grid-list
const showMore = () => {
const cards = document.querySelectorAll(".product-card");
cards.forEach((card) => {
card.classList.remove("hide");
card.classList.remove("mobile-hide");
});
document.querySelectorAll(".show-more-btn")[0].style.display = "none";
};
// FAQ
const showElement = (faqAnswer, faqMinusIcon, faqPlusIcon) => {
if (document.getElementById(faqAnswer.id).style.display === "none") {
document.getElementById(faqAnswer.id).style.display = "block";
document.getElementById(faqMinusIcon.id).style.display = "block";
document.getElementById(faqPlusIcon.id).style.display = "none";
} else {
document.getElementById(faqAnswer.id).style.display = "none";
document.getElementById(faqMinusIcon.id).style.display = "none";
document.getElementById(faqPlusIcon.id).style.display = "block";
}
};