I created a nested list with a drag and drop function. My problem is that I want each nesting sorted by itself. For instance:
-first_level
-first_level
-second_level
-second_level
-first_level
The "first level" should not be included in the "Second level" and vice versa. I thought I could do this with the containment option, but there are no dice there. It works with maintaining the second level from the first level, but not vice versa.
Here is my JS example and list:
$("#sort_list").sortable({ containment: '#sort_list', axis: 'y', revert: true, items: 'li', opacity: 0.8 }); $(".sub_list").sortable({ containment: 'parent', axis: 'y', revert: true, items: 'li', 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>
Any ideas? Thanks guys!
Davy source share