Can mouseenter be made to not fire in IE on DOMready?
Posted
by
mrclay
on Stack Overflow
See other posts from Stack Overflow
or by mrclay
Published on 2011-01-06T18:38:08Z
Indexed on
2011/01/07
2:54 UTC
Read the original article
Hit count: 355
jQuery emulates IE's mouseenter event on non-IE browsers. In IE, however, mouseenter is being triggered when the page loads (maybe due to jQuery's use of doScroll
in the $.ready
implementation), even if the mouse is not moved at all.
This doesn't happen in other browsers and definitely doesn't follow Microsoft's own spec, which says (emphasis mine):
The event fires only if the mouse pointer is outside the boundaries of the object and the user moves the mouse pointer inside the boundaries of the object. If the mouse pointer is currently inside the boundaries of the object, for the event to fire, the user must move the mouse pointer outside the boundaries of the object and then back inside the boundaries of the object.
This only becomes an issue of usability if hover (or the hoverIntent plugin) is applied to a navigational item to display a drop down or "mega-menu": In IE, mouseenter will fire immediately after $.ready
, obscuring the content with the menu. I've put together a demonstration of both the mouseenter inconsistency and the usability issue it creates.
© Stack Overflow or respective owner