我试图让以下内容工作,但无法找到正确的方法来使用stop事件. 我有两列你可以从右向左拖动.如果丢弃无效,我的恢复功能正常工作,但如果左列发生有效丢弃,我想删除右列中的项目.我知
我有两列你可以从右向左拖动.如果丢弃无效,我的恢复功能正常工作,但如果左列发生有效丢弃,我想删除右列中的项目.我知道条件不正确,但我不确定要查找哪个标志以确定丢弃是否有效.
$("#sortable2 li").draggable({
connectToSortable: "#sortable1",
helper: "clone",
revert: "invalid",
stop: function (event, ui) {
if (drop == "valid")
{
$(this).remove();
}
}
});
您可以使用.sortable上的receive事件处理删除原始元素
example jsfiddle
$("#sortable1").sortable({
receive: function (event, ui) { // add this handler
ui.item.remove(); // remove original item
}
});
$("#sortable2 li").draggable({
connectToSortable: "#sortable1",
helper: "clone",
revert: "invalid"
});
