2011-03-06 86 views
0

我正在尋找一種方法,在元素離開特定放置點後立即將元素恢復到其原始大小和位置。jQuery UI恢復事件

從本質上講,我所選擇的圖像可以拖入可拖放區域並調整大小,但我希望能夠通過將圖像從可丟棄區域移出來將圖像「放回」原始位置。

謝謝!

回答

0

如果您做出以下可能的話:

$("#droppable").droppable({ 
out: function(event, ui) { 
$(ui.draggable).draggable({ revert: true }); 
var revert = $(ui.draggable).draggable("option", "revert"); 
$(ui.draggable).draggable("option", "revert", true); 
alert('out: '+$(ui.draggable).position().left); 
} 
}); 

的壞消息是,第二運動之後,該塊被移到別的地方不是它原來的possition。我只是被問到可能的解決方案在這個頁面上。

Trouble with dragged revert at multiple block movement