Saturday, October 6, 2012

Use mouseenter/mouseleave instead of mouseover / mouseout events


The problem:

When you have mouseover and mouseout events bound to some element on you page with children elements. Hovering over children element fires parent’s mouseover and/ormouseout event.

The solution:

The solution to this error is to use mouseenter and mouseleave events instead ofmouseover and mouseout.

The reason:

This solution works because mouseover and mouseout events do not bubble from child to parent element.

Source and credit goes to:  http://jquery-howto.blogspot.in/
   http://jquery-howto.blogspot.in/2009/04/problems-with-jquery-mouseover-mouseout.html

No comments:

Post a Comment