0
我想用jQuery Sortable排序項目。出於某種原因,我無法對孩子li
進行排序,只有父母li
可以被移動和排序。當我嘗試移動孩子li
,它的動作與父ul
不能排序子項
$("#list-tree-pages").sortable({
placeholder: "ui-state-highlight",
items: "> li",
revert: true
});
$("#list-tree-pages").disableSelection();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="parent-0 ui-sortable" id="list-tree-pages">
<li class="item-3 has-children"><a href="#" class="drag ui-sortable-handle"><i class="fa fa-bars"></i></a><a href="#">Features</a>
<ul class="submenu" id="parent-3" style="display: block;">
<li class="item-10"><a href="#" class="drag ui-sortable-handle"><i class="fa fa-bars"></i></a><a href="#">Features 1</a></li>
<li class="item-11"><a href="#" class="drag ui-sortable-handle"><i class="fa fa-bars"></i></a><a href="#">Features 2</a></li>
<li class="item-12"><a href="#" class="drag ui-sortable-handle"><i class="fa fa-bars"></i></a><a href="#">Features 3</a></li>
</ul>
</li>
</ul>