mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-15 19:23:58 +01:00
Implemented reinitialisation of event listeners
This commit is contained in:
parent
066f10edfc
commit
b74ff2da78
@ -9,6 +9,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
function onMouseEnter() {
|
||||
clearTimeout(timeout);
|
||||
openMenu(item, isTopLevel);
|
||||
refreshEventListeners();
|
||||
}
|
||||
|
||||
function onMouseLeave() {
|
||||
@ -32,10 +33,18 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
} else {
|
||||
openMenu(item, isTopLevel);
|
||||
}
|
||||
refreshEventListeners();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refreshEventListeners() {
|
||||
const updatedMenuItems = document.querySelectorAll('.nav-item.dropdown');
|
||||
const updatedSubMenuItems = document.querySelectorAll('.dropdown-submenu');
|
||||
addMenuEventListeners(updatedMenuItems, true);
|
||||
addMenuEventListeners(updatedSubMenuItems, false);
|
||||
}
|
||||
|
||||
addMenuEventListeners(menuItems, true);
|
||||
addMenuEventListeners(subMenuItems, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user