I’m having a problem in IE 9 (haven’t tested 8), What the code is supposed to do is detect whether or not the mouse was dragged after clicking on a certain element. The problem is that IE 9 automatically enters the $(window).mousemove event handler even though I don’t move the mouse. Works Fine in Chrome and FF.
$(Element).mousedown(function() {
$(window).mousemove(function() {
isDragging = true;
$(window).unbind("mousemove");
});
}).mouseup(function() {
$(window).unbind("mousemove");
});
You should be only starting a drag after the mouse has moved a certain minimum distance. To do that, record the mouse position in the mousedown handler and then in mousemove, only start your drag when the mouse has moved a minimum distance.
FYI, some mice can record very, very tiny movements (less than one pixel on the screen) so it’s likely that the mouse does actually move after you press the mouse down and IE is probably just reporting that movement. Other browsers may wait until the mouse moves a whole pixel. In any case, if you require a minimum number of pixels of movement then you won’t have this issue.