Hello, good people. Help me to understand. There is a left column in which the pictures are located and they can be dragged .draggable and there is the main content that accepts those same pictures .droppable, the pictures are cloned into the content using the clone method and again become dragged. But the problem is that when they are dragged into the content, they continue to be cloned. And I do not need this at all. How to fix the code?
html code
<div id="wraper"> <div id="heder"></div> <div id="saitbar"> <div id="element1" ><img src="images/1.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element2" ><img src="images/2.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element3" ><img src="images/3.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <!--<div id="element4" ><img src="images/1.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element5" ><img src="images/2.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element6" ><img src="images/3.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element7" ><img src="images/1.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element8" ><img src="images/2.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div> <div id="element9" ><img src="images/3.png" width="100" height="100" alt="ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΠ°" /></div>--> </div> <div id="content"> <div id="contener" class="ui-widget-content"></div> </div>
js code
$(document).ready(function() { // ΠΏΠ΅ΡΠ΅ΡΠ°ΡΠΊΠΈΠ²Π°Π½ΠΈΠ΅ $('div[id*=element]').draggable({ containment: "#wraper", revert: "invalid", grid: [ 20,20 ], opacity: 0.5, scroll:false, zIndex: 35, appendTo: "body", helper: "clone", cursor: "move", stack:"div[id*=element]" }); //ΠΏΡΠΈΠ΅ΠΌΠ½ΠΈΠΊ $( "#contener" ).resizable().droppable({ accept: "div[id*=element]", activeClass: "ui-state-highlight", drop: function( event, ui ) { var element = $(ui.draggable); element.fadeIn(1000, function() { $(this).clone() .addClass("newElement") .appendTo("#contener") .draggable() }); } }); });