无法使用脚本般的可排序对象将项目拖到一个空列表中

时间:2020-03-05 18:58:25  来源:igfitidea点击:

我创建了三个无序列表,这些列表已创建为Scriptaculous Sortables,以便用户可以在列表内以及它们之间拖动项目:

var lists = ["pageitems","rowitems","columnitems"];    
Sortable.create("pageitems", { dropOnEmpty: true, containment: lists, constraint: false });
    Sortable.create("rowitems", { dropOnEmpty: true, containment: lists, constraint: false });
    Sortable.create("columnitems", { dropOnEmpty: true, containment: lists, constraint: false });

我如何做到这一点,以便如果用户将所有项目拖出列表,他们能够再次将它们放回原处?目前,它不允许将项目拖到一个空列表中。

解决方案

回答

可能空白列表没有高度,因此没有可用的可放置区域。如果是这种情况,也许我们只需要设置最小高度,或者在块上设置一些填充即可。

回答

确保目标列表的样式为float:left

我今天也有类似的经历。

回答

将dropOnEmpty:true添加到options参数。