一个小问题,希望有一个简单的答案,我正在使用jQuery拖拽和放置项目到一个码头。使用下面的代码进行拖放。
$("#dock").droppable({
drop: function(event, ui) {
//Do something to the element dropped?!?
}
});然而,我找不到一种方法来获取实际删除的元素,所以我可以做一些事情。这个是可能的吗?
发布于 2010-06-04 22:41:21
从drop event documentation
当接受的可拖动对象被拖放到此可拖对象的“上方”(在其允许范围内)时,将触发此事件。在回调中,
$(this)表示拖放对象所在的droppable。而ui.draggable表示可拖动的。
所以:
$("#dock").droppable({
drop: function(event, ui) {
// do something with the dock
$(this).doSomething();
// do something with the draggable item
$(ui.draggable).doSomething();
}
});https://stackoverflow.com/questions/2975091
复制相似问题