我正在做drag n drop事件,因为我想将元素放在droppable元素上。
<div class="draggable ui-draggable" id="800068">
<h5>test 2.mp4</h5>
</div>
我将它放入::
<div class="drop" data-bind:"foreach:items">
<div class="slot">
<p data-bind="text"></p>
</div>
</div>
&安培;我的Jquery代码用于拖放drop是::
$('.draggable').draggable();
$('.drop').droppable();
但Dropped元素附加在&amp;的底部。我想在方式so that I can be over Slot as well as over <p>
答案 0 :(得分:0)
$(".slot").droppable({
accept: ".draggable",
tolerance:"pointer",
drop: function (event, ui) {
var dropped = ui.draggable;
var droppedOn = this;
$(dropped).detach().css({ top: 0, left: 0 });
$(droppedOn).before($(dropped));
$(dropped).append("<h5></h5>");
$(dropped).find('h5').text("hello test");
}
});
如果你想要的话,这会把它放在它被删除的div之下吗?