jQuery鼠标在窗口外–可能吗? [英] JQuery mouseup outside window – possible?

查看:132
本文介绍了jQuery鼠标在窗口外–可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力完成一项基本任务.在mousedown上,该项目开始拖动,但速度不与鼠标相同,因此当鼠标位于窗口外部时,我继续拖动,但是如果鼠标不在页面上方,则无法获取mouseup事件.

I am trying to accomplish a rudimentary drag. On mousedown the item starts dragging, but not at the same speed as the mouse, so i continue dragging when the mouse is outside the window, but if the mouse is not over the page i can't get mouseup events.

我可以看到其他页面执行此操作,因此我知道这是可能的.感谢任何帮助.

I can see other pages do this so i know it is possible. Appreciate any help.

例如

在Vimeo上播放任何视频 http://vimeo.com/19831216 确保窗口足够小您的屏幕上方有空格,然后左右拖动视频的进度条,现在将光标移到窗口顶部边缘之外,同时仍然向左/向右拖动-看到了吗?现在,仍在窗口外时释放鼠标按钮-拖动结束,视频继续播放.

Play any video on Vimeo http://vimeo.com/19831216 make sure the window is small enough on your screen with space above it, then drag the video's progress bar left and right, now move the cursor outside the top edge of the window while still dragging left/right - see? Now release mouse button while still outside of the window - dragging ends and video continues playing.

注意:Vimeo可以选择使用Flash播放器或HTML5播放器,并且可以使用html5播放器.

Note: Vimeo has an option to use a flash player or HTML5 player and this is with the html5 player.

推荐答案

您实际上可以将鼠标悬停在浏览器窗口之外.

You actually can get the mouseup outside of the browser's window.

至少对我有用.

$(function(){
    $(window).mouseup(function(){
       alert('mouse up'); 
    });
});

http://jsfiddle.net/fFeJ6/

在Ubuntu Maverick上使用Chrome 10.

Working on Chrome 10 on Ubuntu Maverick.

这篇关于jQuery鼠标在窗口外–可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆