get div id when an object is dropped using jquery -
i want div id of dragged item when dropped div. problem , when drop layer 3, reads layer 1 , layer 2. want layer 3 since hovered.
please consider code below.
thanks in advance.
<div> <img class="item" src="img.jpg"/> </div> <div id="layer1" class="droppable" style="width:100px; height : 100px ;"> <div id="layer2" class="droppable" style="width:70px; height : 70px; "> <div id="layer3" class="droppable" style="width:50px; height: 50px"> drop image here </div> </div> </div> <script> $(function(){ $(".droppable").droppable({ accept : 'item' , drop : calldropp }); function calldropp (){ <!-- here --> } }) </script>
try using event.stoppropagation
:
$(function(){ $(".droppable").droppable({ accept : 'item' , drop : calldropp }); function calldropp (event){ event.stoppropagation(); } });
this should stop dropping propagation @ inner element.
Comments
Post a Comment