为什么当我将我draggable
的 div拖到 div 时,droppable1
它总是被放置在droppable2
div 中。
此外,我遵循了 jQuery UI snap-back 选项,但它不起作用。我怎样才能让它而不是拖动实际draggable
元素,而是拖动它的实例/副本并droppable
接受多个这些draggable
元素。
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$( '#draggable' ).draggable();
$( '#droppable1' ).droppable({
drop: function(event, ui)
{
$(this)
.append(ui.draggable.css({position: 'relative', left: '0px', top: '0px'}));
}
});
$( '#droppable2' ).droppable({
drop: function(event, ui)
{
$(this)
.append(ui.draggable.css({position: 'relative', left: '0px', top: '0px'}));
}
});
});
</script>
<div class="well">
<div id="draggable">CONTENT</div>
</div>
<div id="droppable1" class="well col-md-3" style="z-index:-1;"></div>
<div id="droppable2" class="well col-md-9" style="z-index:-1;"></div>