我有一个jQuery-UI“可排序”的项目列表。我想在页面的其他位置删除此列表中的元素。
具体而言,它是一个CMS。我可以使用jQuery.ui.sortable重新排序内容项。我想拖延在页面上的其他地方的“回收站”链接上删除其中一个元素。
当我将可拖动元素放在页面的特定元素上时,如何执行特定操作?如何才能获得项目?
由于
答案 0 :(得分:3)
我有类似的情况,但我为我的回收站设置了<div>
并使其成为连接列表。这是我的剧本:
$('#rubbishBin').sortable({
placeholder: 'deletingPlaceholder',
update: function (event, ui) {
ui.item.hide();
// Do what you need to to delete the item from the database
}
});
$('#itemContainer').sortable({
opacity: 0.6,
cursor: 'move',
revert: true,
delay: 250,
tolerance: 'intersect',
placeholder: 'draggingPlaceholder',
connectWith: '#rubbishBin'
});