在jquery UI拖拽效果中,如何找到被拖拽的拖拽效果?
$('#test').droppable({
drop: function (e,ui) {
//$(this) means the drop-container
//How can I use the "ui" parameter find the being draged one?
}
}
}
当拖拽的<li>离开可丢弃的#div1时,如何强制拖拽的<li>丢弃?
$("li").draggable();
$("#div1").droppable({
tolerance:'pointer',
drop:function (event,ui) {
alert("dropped")
},
out:function (event,ui){
//if out then drop the li
}
}
我有一个拖拽列表(.field),你可以拖拽项目到一个可排序列表(.sortlist)中。我这样做是因为我不想以任何方式修改主列表(.field)。它工作得很好,除了我不知道如何操作可排序列表中被删除的字段。
我可以通过在droppable ()中的'drop:‘函数中使用以下代码从可拖动对象拖入可放入区域:
$(this).append('html code here to change content of dragged field');
但是,这在sortable()中不起作用。我的代码如下所示:
$(".sortlist").sortable(
我是一个完整的jQuery和Javascript菜鸟,试图获得一个非常简单的拖放现场演示工作。我越来越接近了,但我的拖拽元素被赋予了绝对的位置,所以它们不能很好地流动在一起。
标记非常简单:
<section class="favrecentboxessection" id="favorites">
little divs with the style set to draggable
</section>
<section class="favrecentboxessection" id=&