jQuery UI:开始拖动之前 [英] jQuery UI : Before start draggable

查看:152
本文介绍了jQuery UI:开始拖动之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案如何实现一个before start事件来改变在jQueryUI开始拖动之前可以拖动的元素的DOM中的位置和位置?方案

您可以扩展原型方法:



查看演示

  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 ::');
}
});


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?

解决方案

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::');
    }
});

这篇关于jQuery UI:开始拖动之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆