I have the following code which works although it runs quite slowly I feel. What I want to do is allow <li>
's to be moved freely under existing <ul>
's or move them up a level. I also want to be able to create heirarchies so if you dragged a <li>
under another <li>
that would create a heirarchy. I think in that sense I would have to render a <ul>
under each <li>
just in case. I only want to limit it to 2 or 3 levels deep.
$("#sort_list").sortable({
containment: 'parent',
axis: 'y',
revert: true,
opacity: 0.8
});
$(".sub_list").sortable({
containment: 'parent',
axis: 'y',
revert: true,
opacity: 0.8,
});
$("#sort_list").disableSelection();
<ul id="sort_list">
<li>one</li>
<li>two
<ul class="sub_list">
<li>sub one</li>
<li>sub two</li>
</ul>
</li>
<li>three</li>
<li>four</li>
</ul>