JQuery.trigger ('stop') method for .draggable

$('#element').draggable ({
    stop: function () {
        alert ('stopped');
        //do some action here
    }
}).trigger('stop');

nothing happens, the thought is #elementnow dragged, and the event is executed after the drag is completed. I tried .triggerHandleas well 'dragstop'as eventtype, no luck

+5
source share
2 answers

Use this to call it:

.trigger('dragstop')

If you want it to behave completely like a normal event, use .bind ('dragstop', function) to attach it, the launch parameter behaves a little differently.

+5
source

, , jquery ui dragstart dragstop jQuery .

, , ( )

$(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});
    }
});
-1

All Articles