开发者

how to catch this event that when i left click and then move some where (not drag some div ) on a div

this is my code:

$('#handle').mousedown(function(e){
if( (!$.browser.msie && e.button == 0)开发者_Go百科 || ($.browser.msie && e.button == 1) ) {
       alert("Left Button");
    }
})

this event is like to drag , but not drag ,

the left button Has been pressed, no released until mouseup,

so how to catch it using jquery ,

this is my demo : http://jsfiddle.net/ATZNW/1/

thanks


jQuery doesn't do this out of the box but you can fire your own events. Instead of alerting "left button", set some global variable dragging to true. Then:

$("#handle").mousemove(function (e) {
   if (dragging) {
      $(this).trigger("dragmove");
      // Or just write the code you need here
   }
});

Then you can handle that event elsewhere if you wish:

$("#handle").bind("dragmove", function (e) {

});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜