更新:
http://jsfiddle.net/wJUHF/7/
这是任何可能阅读此内容的人的更新和工作小提琴.
我试图让这个小伙子工作.
这就是问题所在.我可以将图像拖到容器中.它附加一个克隆,没有问题.当我单击以将克隆的图像拖动到容器中时,它第一次正常工作.我第二次点击拖动,它不会拖动但克隆已经克隆的图像.为了更好地理解,我创建了一个jsfiddle.请看看,让我知道我在哪里错了.
谢谢
码:
$(function(){
//Make every clone image unique.
var counts = [0];
$(".dragImg").draggable({
helper: "clone",
//Create counter
start: function() { counts[0]++; }
});
$("#dropHere").droppable({
drop: function(e, ui){
$(this).append($(ui.helper).clone());
//Pointing to the dragImg class in dropHere and add new class.
$("#dropHere .dragImg").addClass("item-"+counts[0]);
//Remove the current class (ui-draggable and dragImg)
$("#dropHere .item-"+counts[0]).removeClass("dragImg ui-draggable ui-draggable-dragging");
//not working 100%
$(".item-"+counts[0]).dblclick(function(){
$(this).remove();
});
//make the div draggable --- Not working???
make_draggable($(".item-1"));
}
});
var zIndex = 0;
function make_draggable(elements) …Run Code Online (Sandbox Code Playgroud)