I've got a navigation built with JS using a class constructor. This is the code for the mouseover/mouseout functionality
export default class MeganavItem {
constructor(element, meganav) {
this.element = element;
this.meganav = meganav;
this.content = element.querySelector(selectors.content);
this.menus = Array
.from(element.querySelectorAll(selectors.menus))
.map(menu => new MeganavMenu(menu, this));
this.attachEvents();
}
attachEvents() {
this.element.addEventListener('mouseover', e => this.openContent(e));
this.element.addEventListener('mouseout', e => this.closeContent(e));
}
openContent() {
this.content.setAttribute('aria-hidden', false);
}
closeContent() {
this.content.setAttribute('aria-hidden', true);
}
}
However, I need to delay the mouseover by 100ms and not sure how to do this within the attachEvents function?