Search code examples
javascriptdom-eventsmouseout

JavaScript mouseout triggered when over children


I am working on menu to my website and I need to user over/out to show/hide submenu + animation.

I got the following code: http://jsfiddle.net/JyTPW/

When I mouseover "products" and then go to child element, the mouseout is triggered. I tried to fix it but I failed. I read all the posts about checking the reltarget and etc but still I failed to make it work.

I would really appreciate your help.

Edit:
After long search I found Cross-browser event registration which provide mouseenter and mouseleave.
It fixed my problem.


Solution

  • Well, if you think about it, it is doing it as expected. But not as a programmer would like it. Microsoft went the way of doing what you wanted. Everyone else, didnt. The solution? Use jQuery and listen to the custom mousenter/mouseleave event