Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress set passive listener to active

I have a wordpress site where I'm getting the following error in the developer console using chrome:

[Intervention] Unable to preventDefault inside passive event listener due to 
target being treated as passive.

I have one javascript snippet where I set 4 listeners:

function moveDown(){                    
   const submenus = document.getElementsByClassName('sub-menu')  
   var navbar = document.getElementById("menu-1");
   var sub = this.getElementsByTagName('ul')[0]
   var rect = sub.getBoundingClientRect();      
   navbar.style.marginBottom = rect.height + "px"       
}


function moveUp(event){  
   var navbar = document.getElementById("menu-1");
       navbar.style.marginBottom = 0    
}


(function(){
   var takeAction = document.getElementsByClassName('takeAction')[0] 
   var aboutUs = document.getElementsByClassName('aboutUs')[0] 


   aboutUs.addEventListener('mouseover', moveDown,{passive: false})
   takeAction.addEventListener('mouseover', moveDown,{passive: false})  

   aboutUs.addEventListener('mouseleave', function(event) {moveUp(event)},{passive: false})
   takeAction.addEventListener('mouseleave', function(event) {moveUp(event)},{passive: false})      


})()

Since I'm already setting {passive:false} on each listener, how do I fix this?

like image 956
DCR Avatar asked Oct 28 '22 07:10

DCR


1 Answers

problem has gone away. seems like a wordpress thing but who knows

like image 76
DCR Avatar answered Oct 31 '22 09:10

DCR