mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-15 19:23:58 +01:00
refaktored
This commit is contained in:
parent
ac0b1e9a14
commit
abdaf54147
@ -6,16 +6,22 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
let timeout;
|
let timeout;
|
||||||
|
|
||||||
// Öffnen beim Hovern
|
function onMouseEnter() {
|
||||||
item.addEventListener('mouseenter', () => {
|
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
openMenu(item, isTopLevel);
|
openMenu(item, isTopLevel);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function onMouseLeave() {
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
closeMenu(item);
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Öffnen beim Hovern
|
||||||
|
item.addEventListener('mouseenter', onMouseEnter);
|
||||||
|
|
||||||
// Verzögertes Schließen beim Verlassen
|
// Verzögertes Schließen beim Verlassen
|
||||||
item.addEventListener('mouseleave', () => {
|
item.addEventListener('mouseleave', onMouseLeave);
|
||||||
timeout = setTimeout(() => closeMenu(item), 500);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Öffnen und Position anpassen beim Klicken
|
// Öffnen und Position anpassen beim Klicken
|
||||||
item.addEventListener('click', (e) => {
|
item.addEventListener('click', (e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user