0
我有這個代碼,當我在另一個彈出一個確認對話框時,激活管理系統文件中的jQuery可拖動當我點擊取消時,可拖動的應該會自動恢復,有人可以幫助我?jquery ui恢復刪除可拖動取消模式
$(function() {
$('.files-icons li').live('mouseenter',function() {
var $this = $(this);
if(!$this.is(':data(draggable)')) {
$this.draggable({
revert: 'invalid',
helper: "original",
opacity: 0.35,
snapMode: 'inner',
snap:true,
snapTolerance: 35,
distance: 8,
revertDuration: 200,
start: function(){
}
});
}
});
$('.ic').live('mouseenter',function() {
var $this = $(this);
if(!$this.is(':data(droppable)')) {
$this.droppable({
tolerance: 'intersect',
over: function() {
},
out: function() {
},
drop: function(event, ui) {
dest = $(this).attr('rel');
$.modal.confirm('Are u sure?', function()
{
$.ajax({
url:'<?= $this->request->webroot; ?>files/move/source:' + ui.helper.attr('rel') + '/dest:' + dest ,
}).done(function(data) {
$(ui.draggable).remove();
});
}, function() {
return false;
});
}
});
}
});
});
問題是,你把滴落確認,所以當你釋放它,你已經放棄了物品。 看看這裏:http://stackoverflow.com/questions/5735270/revert-a-jquery-draggable-object-back-to-its-original-container-on-out-event-of – Lefsler