我有一个小的可拖动/可放置的 jquery 应用程序,我无法保留可拖动项目并在其克隆被删除后将其保持在其原始位置。
有人可以帮忙吗?
http://jsfiddle.net/franco13/vLSZf/1/
谢谢你。
$(init);
function init() {
$('.teamEmblem').draggable({
// containment: $('.teamEmblem').parent(), // this does not work
cursor: 'move',
helper: 'clone',
obstacle: ".teamEmblem", // this does not work
preventCollision: true, // this does not work
revert: true
});
$('.winner').droppable({
hoverClass: 'hovered',
tolerance: 'touch',
drop: handleCardDrop1
});
}
function handleCardDrop1(event, ui) {
if (true) {
ui.draggable.addClass('correct');
ui.draggable.draggable('disable');
$(this).droppable('disable');
ui.draggable.position({
of: $(this),
my: 'left top',
at: 'left top'
});
ui.draggable.draggable('option', 'revert', false);
}
}