我正在使用 jqueryUI 将列表项从一个列表拖放到另一个可排序列表。无论如何,当它从 all-colls-list 删除到可排序列表 coll-selected-list 时,我可以将删除的项目的类从“sortedli”更改为“droppedli”,反之亦然?目前,当我删除它时,它会保留原来的类名。
$(function() {
var lists = [{"listid":"#all-colls-list", "connectid":"#coll-selected-list", "drop":true},
{"listid":"#coll-selected-list", "connectid":"#all-colls-list", "drop":true}];
$.each(lists, function(i, list) {
$(list.listid).sortable({
connectWith: list.connectid,
dropOnEmpty: list.drop
});
});
});
<ul id="all-colls-list" class="droptrue ui-sortable">
<li class="sortedli">ahsbah</li>
<li class="sortedli">bachs</li>
<li class="sortedli">stah</li>
</ul>
<ul id="coll-selected-list" class="droptrue ui-sortable">
<li class="sortedli" style="">blah</li>
<li class="sortedli" style="">blah</li>
<li class="sortedli" style="">blah</li>
</ul>