-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.js
28 lines (24 loc) · 1022 Bytes
/
functions.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
document.addEventListener("DOMContentLoaded", () => {
// Target specific menu items that have submenus
const menuItemsWithSubmenus = [
{ menuId: "our-services", submenuId: null },
{ menuId: "interested-in-us", submenuId: null } // Null handles multiple subitems directly inside
];
menuItemsWithSubmenus.forEach(({ menuId, submenuId }) => {
const menu = document.getElementById(menuId);
const submenu = submenuId ? document.getElementById(submenuId) : menu.querySelector(".subitems");
if (submenu) {
// Show submenu on hover
menu.addEventListener("mouseenter", () => {
submenu.style.display = "flex"; // Show submenu
});
// Hide submenu on mouse leave
menu.addEventListener("mouseleave", () => {
submenu.style.display = "none"; // Hide submenu
});
}
});
});
function activateLink(url) {
window.location.href = url;
}