-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
39 lines (30 loc) · 985 Bytes
/
main.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
// show/hide nav menu
const navMenu = document.querySelector(".nav__menu");
const navOpenBtn = document.querySelector("#open-menu-btn");
const navCloseBtn = document.querySelector("#close-menu-btn");
const openNavHandler = () => {
navMenu.style.display = "flex";
navOpenBtn.style.display = "none";
navCloseBtn.style.display = "inline-block";
};
const closeNavHandler = () => {
navMenu.style.display = "none";
navOpenBtn.style.display = "inline-block";
navCloseBtn.style.display = "none";
};
navOpenBtn.addEventListener("click", openNavHandler);
navCloseBtn.addEventListener("click", closeNavHandler);
// Close nav menu on click of nav link small screens
const navItems = navMenu.querySelectorAll("a");
if (window.innerWidth < 768) {
navItems.forEach((item) => {
item.addEventListener("click", closeNavHandler);
});
}
// testimonial section
const swiper = new Swiper(".swiper", {
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});