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) {
});
精彩评论