IE 8 specifying background-color changes element behavior

Posted by Mateo on Stack Overflow See other posts from Stack Overflow or by Mateo
Published on 2011-02-13T05:38:42Z Indexed on 2011/02/13 7:25 UTC
Read the original article Hit count: 237

Filed under:
|
|

I have an absolutely positioned div on which I am trying to trigger mouseenter and mouseleave events. In IE8/7 with the background-color of the div left unspecified (so that it defaults to transparent), the mouseenter/leave events are not firing when the cursor crosses the div's boundary, only somewhere in the middle of the div and when the cursor is over any text within the div.

When I attempt to debug the problem by adding a background color to the div (e.g. background-color: green), the problem magically goes away. The div's box model is honored perfectly and mouseenter/leave fire as when expected. It's only when the div's background color is left unspecified (or even explicitly set to transparent) that it doesn't behave correctly.

Any ideas? Googling for this IE bug/quirk is coming up with nothing.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about css