Javascript - How To Make Multiple Draggable Clones?
now I'm trying to make a simple drag and drop game. The first time I drag and drop a clone works fine, but it doesn't allow me to drag a clone anymore. So I want to create as many
Solution 1:
The code should provide a function for the drop
property. This function should clone the helper and append it to the droppable
. I have provided a basic example which you can apply to your implementation.
HTML
<ul><li>Item 1</li><li>Item 2</li></ul><divid="drop"></div>
Javascript
$("li").draggable(
{helper: "clone"}
);
$("#drop").droppable({
accept: "li",
drop: function(event,ui){
console.log(ui.helper);
$(this).append($(ui.helper).html());
}
});
Working Examplehttp://jsfiddle.net/2W4jA/
Post a Comment for "Javascript - How To Make Multiple Draggable Clones?"