Webkit and Safari fire mousemove even when mouse doesn't move

Posted by Roel on Stack Overflow See other posts from Stack Overflow or by Roel
Published on 2010-04-10T09:44:22Z Indexed on 2010/04/10 9:53 UTC
Read the original article Hit count: 606

I've read about issues where the mousemove event is fired twice in Safari/Webkit, but the problem I'm facing is that mousemove fires even when the mouse is not moved. That is: it already fires when the mouse cursor is positioned above the context that the event is attached to when the page is loaded/refreshed. And because I'm attaching it to 'document' (entire viewport of the browser), it fires right away in Safari. I've tried to attach it to to html element, to the body and to a wrapper div. No change.

$(document).bind('mousemove', function() {
  alert('Mouse moved!');
  $(document).unbind('mousemove');
});

Is does work ok in other browsers. Anyone seeing what I'm doing wrong? Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery