jQuery: Sortable nested list?
i'm building a website which has a parent-child Paging structure. I'm looking for a convenient way to administrate the website structure.
- I want the pages开发者_如何学Go to be sortable
Releasing the jQuery sortable code on my generated sitemap (nested UL), doesn't work properly...
$('ul.SiteMap ul').sortable();
What's really important is that it should not be possible to sort outside of the current UL. Any suggestions?
Thanks in advance.
It works fine for me. I just assigned each ul to be sorted to a class and then did the following:
$('.sortableList').sortable();
Have you tried with:
items: 'ul > li'
?
You have to list all ULs, though:
$('ul.SiteMap ul, ul.sitemap ul ul, ul.sitemap ul ul ul').sortable({
items: 'ul > li'
});
I am a beginner, so there is perhaps a better option.
Changing order of children within a parent is easy just give each ul a class '.sort' and do $('.sort').sortable();
I gets a little trickier when changing the parent.
精彩评论