Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI : Before start draggable

How to implement a before start event to have a change to change the position and place in the DOM of the draggable element before jQueryUI start to drag?

like image 508
Charles Avatar asked Dec 01 '22 19:12

Charles


1 Answers

You could extent prototype method:

SEE DEMO

var oldMouseStart = $.ui.draggable.prototype._mouseStart;
$.ui.draggable.prototype._mouseStart = function (event, overrideHandle, noActivation) {
    this._trigger("beforeStart", event, this._uiHash());
    oldMouseStart.apply(this, [event, overrideHandle, noActivation]);
};

$("#draggable").draggable({
    beforeStart: function () {
        console.log('beforeStart::');
    }
});
like image 164
A. Wolff Avatar answered Dec 10 '22 13:12

A. Wolff