我有以下代码片段
$(document).mousedown(function(event) {
doSomething();
}
我可以捕获mousedown
活动成功。
我正在尝试执行以下操作:
- 捕捉第一个
mousedown
event
- 我想检测用户是否仍然按住鼠标,以便我可以做其他事情。
就像是
var mouseStillDown = false;
$(document).mousedown(function(event) {
mouseStillDown = true;
doSomething();
});
function doSomething() {
if (!mouseStillDown) { return; } // we could have come back from
// SetInterval and the mouse is no longer down
// do something
if (mouseStillDown) { setInterval("doSomething", 100); }
}
$(document).mouseup(function(event) {
mouseStillDown = false;
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)