I have two simultaneously events
document.addEventListener("DOMContentLoaded", function() {
Array.from(popUps).forEach((el, index) => {
const listener = () => {
let trParent = el.parentNode;
popUpsChilds[index].classList.toggle("show");
tableThMain.classList.toggle("toggle-goods-popup-for-head");
el.classList.toggle("toggle-goods-popup-for-cell");
trParent.classList.toggle("tr-height");
}
el.addEventListener("mouseover", listener, false);
el.addEventListener("mouseout", listener, false);
});
});
Sometimes, when page may be is not loaded completely, “mouseout” couldn’t happen. But i’ve putted DOMContentLoaded event.
What should I do with it?