I m having a hard time trying to lock the depth of nested sortable elements, so that they can only sort up and down among their direct siblings.
我认为我这样做了,但我仍然能够把儿童物品从母子中删除,反之亦然。
var $sort = $( #outside-wrapper ).sortable({
axis : y ,
items : .item ,
start : function( event, ui ) {
// dynamically set the containment to the item s direct parent once started
$sort.sortable( option , containment , ui.item[0].parentNode );
}
});
这里是标志要求的一个例子;
<div class="item">
<div class="item"><!-- content --></div>
<div class="item">
<div class="item"><!-- content --></div>
<div class="item">
<div class="item"><!-- content --></div>
</div>
</div>
</div>
赞赏任何要点!