views:

212

answers:

0

Hi, I have bumped into a weird issue.

jQuery 1.4.1 mouseenter/mouseleave events fire up correctly if the mouse is being moved, not a big deal. However, it bugs in some browsers when the cursor itself remains static but the element is being moved away by animate().

So imagine the code like this:

jQuery('somelement').bind(
{
   mouseenter: function(e) {
     log.debug("enter");
     $(this).animate({left: 9999}, 2000);
   },
   mouseleave: function() {
     log.debug("leave");
   }
});

if you rapidly move the mouse onto the element and then stop it, you'll get different results depending on the browser.

FF3.6, Safari 4, IE7: mouseleave fired as expected when cursor has left the animated element, even if the mouse itself stands still.

IE6, IE8, Opera 9/10, Safari 3, Chrome: mouseleave NOT fired even when the element is outside the window. It takes a slight mouse move to trigger correct mouseleave event.

Any ideas how to fix it?