Added dropdown menu for the Services link
This commit is contained in:
1 parent
3a4b43ec88
commit
92d47b8e1d
8 files changed
+326
-14
No files matched your search
@@ -16,6 +16,34 @@ navLinks.forEach((link) => {
|
||||
});
|
||||
});
|
||||
|
||||
// Dropdown menu for Services
|
||||
const dropdownItems = document.querySelectorAll(".nav-item-dropdown");
|
||||
|
||||
dropdownItems.forEach((item) => {
|
||||
const trigger = item.querySelector(".main-nav-link");
|
||||
|
||||
trigger.addEventListener("click", (e) => {
|
||||
const isMobile = window.matchMedia("(max-width: 63em)").matches;
|
||||
if (isMobile) {
|
||||
e.preventDefault();
|
||||
item.classList.toggle("dropdown-open");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll(".dropdown-link").forEach((link) => {
|
||||
link.addEventListener("click", () => {
|
||||
headerEl.classList.remove("nav-open");
|
||||
dropdownItems.forEach((item) => item.classList.remove("dropdown-open"));
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener("click", (e) => {
|
||||
if (!e.target.closest(".nav-item-dropdown")) {
|
||||
dropdownItems.forEach((item) => item.classList.remove("dropdown-open"));
|
||||
}
|
||||
});
|
||||
|
||||
// Testimonial Slider
|
||||
const testimonials = [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user