What is the difference between jQuery's mouseout() and mouseleave()?

Dave picture Dave · Nov 23, 2010 · Viewed 51.3k times · Source

What is the difference between jQuery's mouseout() and mouseleave()?

Answer

meder omuraliev picture meder omuraliev · Nov 23, 2010

The mouseleave event differs from mouseout in the way it handles event bubbling. If mouseout were used in this example, then when the mouse pointer moved out of the Inner element, the handler would be triggered. This is usually undesirable behavior. The mouseleave event, on the other hand, only triggers its handler when the mouse leaves the element it is bound to, not a descendant. So in this example, the handler is triggered when the mouse leaves the Outer element, but not the Inner element.

Source: http://api.jquery.com/mouseleave/