$(\'#element\').draggable ({
stop: function () {
alert (\'stopped\');
//do some action here
}
}).trigger(\'stop\');
nothing
I know this is an old question, but now it is possible to trigger the actual drag event of jquery ui instead of the dragstart and dragstop by using the jQuery simulate plugin.
Here is the code I used because I needed access to the snapping elements of my resizable object (data only accesible on drag stop)
$(this).resizable({
handles: 'e',
stop: function (e, ui) {
var resizable = ui.element;
resizable.simulate("mousedown", {clientX: e.clientX, clientY: e.clientY});
resizable.simulate("mousemove", {clientX: e.clientX + 10, clientY: e.clientY + 10});
resizable.simulate("mouseup", {clientX: e.clientX, clientY: e.clientY});
}
});
Use this to trigger it instead:
.trigger('dragstop')
If you want it to behave completely as a normal event, use .bind('dragstop', function) to attach it as well, the start option behaves slightly differently.