How can I use the jQuery UI draggable options in a “bind” function? Using the standard draggable() function doesn’t work with what I want to do.
Thanks!
$('a#dragthis')
.bind('dragstart', function(e) {
isDragging = true;
})
.bind('drag', function(e) {
var x = e.pageX;
var y = e.pageY;
console.log(x + "|" + y);
motivationIsWorking(x, y);
})
.bind('dragend', function(e) {
isDragging = false;
motivationStopped();
unmotivateUser();
});
Draggable has callback functions to do exactly what you are looking for:
http://jqueryui.com/draggable/
http://api.jqueryui.com/draggable/#event-stop
So instead of this
do this