admin管理员组文章数量:1315069
I am looking for jQuery solution to detect mouseup
outside the window. That is, after the mouse has been downed inside the window, dragged outside while still down, and then released outside, is when the event should fire.
I tried document.mouseup = function() {}
, it didn't help. I tried to follow the example here, but couldn't properly understand it (I even left a ment asking for help, but no help yet..:( )
I am looking for jQuery solution to detect mouseup
outside the window. That is, after the mouse has been downed inside the window, dragged outside while still down, and then released outside, is when the event should fire.
I tried document.mouseup = function() {}
, it didn't help. I tried to follow the example here, but couldn't properly understand it (I even left a ment asking for help, but no help yet..:( )
-
4
I believe it should be
document.onmouseup
– Fabrício Matté Commented Feb 16, 2013 at 16:38 - Yeah yeah, I mean that actually...:D – NedStarkOfWinterfell Commented Feb 16, 2013 at 17:09
1 Answer
Reset to default 7I have a website that uses this event and it works as you described:
$(window).on('mouseup', function(){
//your code here
});
Note: only tested in jQuery 1.8.3, but it should work in 1.9
jsFiddle confirms. Works in jQuery 1.9.1 and 2 beta: http://jsfiddle/udRNx/1/
In case you didn't know, this piece of code must be placed in either $(document).ready(fn)
or $(window).onload(fn)
.
本文标签: javascriptHow to detect a MouseUp event outside the windowStack Overflow
版权声明:本文标题:javascript - How to detect a MouseUp event outside the window? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741969246a2407734.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论