【发布时间】:2019-09-16 11:53:12
【问题描述】:
我有可排序的列表,在某些情况下我需要防止丢弃,这取决于我在丢弃时“推到一边”的内容。这是一些伪代码:
$('ul#SortableList').sortable( {connectWith: 'ul#OtherList',
beforeStop: function(ev, ui) {
// Need item(s) that are being "pushed" out of the way of the item being dropped
if (adjacentItem == condition)
{ // prevent the drop
$(this).sortable("cancel");
}
我知道“这个”会给我实际的列表本身被丢弃,但我不知道如何让实际的项目被丢弃......甚至只是之前或之后的特定项目会让我继续正确的轨道。
【问题讨论】:
标签: jquery user-interface jquery-ui-sortable drag