I have a nav that has subnavs. When the user hovers over the li’s in the nav I show the subnav for the respective li. I’m running into an issue where moving the mouse from the nav to subnav fires the mouseout. I was thinking I would need to implement a timeout but unsure where to start and can’t get it working. See the below js fiddle…
Share
Try replacing:
With this:
This passes a reference to the function
navMouseOut. ThenavMouseOutparameter$subnavis also passed as a third parameter tosetTimeout. Note the third parameter ofsetTimeoutwill be ignored by IE. Works in all modern browsers though.If you require cross-browser comparability, you should pass an anonymous function to
setTimeoutin order to invokenavMouseOutUpdated Fiddle
More info