I've been looking about the mousemove() and mousedown() methods on the docs @ jQuery's official but didn't managed to come up with a simple solution to listen and do something when the mouse-dragging left/right event happens.
Thank you!
I've been looking about the mousemove() and mousedown() methods on the docs @ jQuery's official but didn't managed to come up with a simple solution to listen and do something when the mouse-dragging left/right event happens.
Thank you!
The obvious starting place is http://api.jqueryui.com/draggable/
Take a look at this fiddle http://jsfiddle.net/MMcYT/ (from How to get the direction of moving object in draggable plugin (jQuery)?) which I think solves your problem
var start,stop;
$("#draggable2").draggable({
axis: "x",
start: function(event, ui) {
start = ui.position.left;
},
stop: function(event, ui) {
stop = ui.position.left;
alert('has moved ' + ((start < stop) ? 'rigth':'left'))
}
});
(Credit to @Reigel)