Saturday 15 March 2014

jQuery mouseup not fired in ie8 -


I have some code collection, such a function:

In the browser, I can drag an image , Code like this:

 activate the  function sub () {isMoving = false; $ Thumb.bind ('Masudown', launcher); } Function startMove () {isMoving = true; $ (Document). Bind ('mausomov', leftupdate); $ (Document) .bind ('mouseup', endmov); return false; } Function endMove () {isMoving = false; $ (Document). Unbind ('mausomov', left updating); $ (Document). Unbreak ('mouseup', endmov); return false; }   

I only copied the part of the functions, but it should be clear ...

The problem is the mouseup event, it is working fine in all browsers IE8 .

When someone presses a thumb and releases the mouse outside the browser, then a mouse movement (without pressing the mouse) will cause the image to be moved.

  • Click on the image
  • Drag it and then release it mouse outside the visible area of ​​the page (for example leave the mouse over the address bar) < Li> Now if you move your mouse up and down, the image goes with your mouse (which is not an ideal behavior)

    IE8 Is there any possible solution for this? I have spent a lot of time on this ...

    I will be online for the answer, thanks a lot!

    This is due to a bug in IE8, I feel that due to poorly implemented protection, is.

    In IE8, once the mouse has left the document, there is no mouse event fire document.mouseup - I think this is a first security bug in IE The reason is, where you can get the coordinates of mouseclick outside the browser window.

    Put another fire on fire when the mouse leaves the area. Fortunately, IE has an appropriate event that we can use here:

      function startMove () {isMoving = true; $ (Document). Bind ('mausomov', leftupdate); return false; } Function endMove () {isMoving = false; $ (Document). Unbind ('mausomov', left updating); return false; } Function activate () {isMoving = false; $ Thumb.bind ('Masudown', launcher); $ (Document) .bind ('mouseup', endmov); // IE 8 Hack - Finish this step even when the mouse leaves the document ($). Bind ('muuleve', endmov); }   

    Note that mouseleave is a required behavior - it only takes a fire when the mouse leaves the document area. Other browsers other than IE support mouseout Instead, but every time the mouse crosses the hair content it is useful, so jQuery.

No comments:

Post a Comment