0

链接到代码 - JS FIDDLE LINK

var makeDrag = function(){
    $("#hello").draggable({
        stop: function(){
            alert("Done dragging");

            $("#hello").draggable("destroy");

            var copy = $("#hello").clone(true);
            $("body").append(copy);
            copy.html("DRAG");
            copy.draggable();
            copy.css("left","120px");
            copy.css("top","140px");

            makeDrag();
        }
    });
}

makeDrag();

<div id="hello">DRAG</div>//THIS DIV SHOULD BE FIXED IN THE SAME POSITION 

我可以拖放,但我要修复 div hello 吗?如何做到这一点?例如示例链接

4

1 回答 1

1

使用helper: "clone"选项。

$("#hello").draggable({
    helper: "clone",
    stop: function(){ 
      //existing stuff
    }
});

工作演示

于 2012-09-11T17:30:32.843 回答