Right now I’m stopping drag events on mouse up, like so:
$(document).mouseup(_onMouseUp);
However I need to capture mouse up events when the mouse leaves the browser window, similar to releaseOutside in Flash.
Is this possible in JS?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t detect a mouseup or mousedown event outside of the browser window, but I think what you are trying to do is cancel a drag or drop when the user clicks off the browser window. You can accomplish that, by reacting to the browser window losing focus, e.g.:
or
This covers you for mouse clicks outside the browser window, and also things like Windows Alt+Tab task switching.