当我单击可拖动的 div 时,场景中的一些 div 变为可放置的,当我将元素拖动到其目的地时,可放置的 div 被禁用。它工作正常,但是当我想再次删除另一个元素时,我无法启用相同的 div。我该如何启用它? http://jsfiddle.net/6v8Lc/3/
function drop (childSocket, inputCache) {
//when "on mousedown" for pawn, pawnSocket calculated if its suitable droppable or not
$(".pawnSocket:nth-child("+childSocket+")").droppable({
hoverClass: "over",
drop: function(ev, ui) {
var thisPosLeft = $(this).position().left;
var thisPosTop = $(this).position().top;
var draggedPawn = $(ui.draggable);
draggedPawn.css({
left: thisPosLeft,
top: thisPosTop
});
var thisIndex = $(this).index();
var suruklenenIndex = piyonYuvaKonum.indexOf(inputCache);
piyonYuvaKonum[suruklenenIndex] = null;
piyonYuvaKonum[thisIndex] = inputCache;
// when i run disable option, it becomes disabled but i can't enable again
$(".pawnSocket").droppable("disable");
//$(this).droppable("option", "disabled", true);
}
});
}