[英]how to catch this event that when i left click and then move some where (not drag some div ) on a div
這是我的代碼:
$('#handle').mousedown(function(e){
if( (!$.browser.msie && e.button == 0) || ($.browser.msie && e.button == 1) ) {
alert("Left Button");
}
})
此事件就像是拖動,但不是拖動,
左按鈕已被按下,直到將其上移后才松開,
那么如何使用jquery捕獲它,
這是我的演示: http : //jsfiddle.net/ATZNW/1/
謝謝
jQuery並沒有開箱即用,但是您可以觸發自己的事件。 而不是警告“左鍵”,而是將一些全局變量dragging
為true。 然后:
$("#handle").mousemove(function (e) {
if (dragging) {
$(this).trigger("dragmove");
// Or just write the code you need here
}
});
然后,您可以根據需要在其他地方處理該事件:
$("#handle").bind("dragmove", function (e) {
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.