skip to Main Content

Javascript – Mouseleave event triggers exception and click event doesn't

I want dropdown list to disappear when mouse leaves #navbarHint div element. let flag2 = true; document.getElementById('navbarHint').addEventListener('mouseleave', function() { flag2 = false; menuClick(); }); document.getElementById('navbtn').addEventListener('click', menuClick); function menuClick() { let menu = document.querySelector('.dropdown:hover .dropdown-content'); if (flag2) { menu.style.visibility = 'visible';…

VIEW QUESTION
Back To Top
Search