Reputation: 4972
Link to the code -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
I am able to drag and drop but i the div hello to be fixed ? how to achieve this? For eg EXAMPLE LINK
Upvotes: 0
Views: 795
Reputation: 14292
Use helper: "clone"
option.
$("#hello").draggable({
helper: "clone",
stop: function(){
//existing stuff
}
});
Upvotes: 1