Skip to content Skip to sidebar Skip to footer

Possible To Get Mouse Events Fired When Cursor Is Outside Page?

I'm creating a game in which one can hold the mouse button and drag it around to rotate an object. However, when the mouse position is outside the page bounds, all mouse events are

Solution 1:

No. But you can track mouseout events and make them act like mouseup.

Solution 2:

Unfortunately not, sorry about that!

Solution 3:

ya that doesn't make sense that you would be able to anyway. If you're not interacting with the browser, then how does the browser know what to do?

Solution 4:

You can use mouseleave, which works in jQuery 1.4.

In JQuery:

$("body").mouseleave(function() {
    //Your code herealert("Mouse has left");
});

This does work in Firefox and IE7 from my testing.

http://www.bennadel.com/blog/1805-jQuery-Events-MouseOver-MouseOut-vs-MouseEnter-MouseLeave.htm

Post a Comment for "Possible To Get Mouse Events Fired When Cursor Is Outside Page?"