Best solution for drag/drop category/subcategory? Tried jQuery UI sortable, now stuck

本小妞迷上赌 提交于 2019-12-11 08:33:38

问题


I have a very crude category list right now, but I'm wanting it to make it look and behave more like WordPress admin does it, where you can drag a category into another category.

Code looks like this:

<ul class="categories">
    <li>Real Estate</li>
    <li>Home Improvements</li>
    <ul class="categories">
        <li>Interior</li>
        <li>Exterior</li>
        <ul class="categories">
            <li>Exterior Subcat</li>
        </ul>
    </ul>
</ul>

I tried jQuery UI's sortable, and told it to sort <li>'s only, but the list items wouldn't drag outside of their parent <ul> list into another <ul> list.

Any ideas how I can accomplish this?


回答1:


See: Sortable + nested lists with jQuery UI 1.8.2

And plugin: http://mjsarfatti.com/sandbox/nestedSortable/



来源:https://stackoverflow.com/questions/9728865/best-solution-for-drag-drop-category-subcategory-tried-jquery-ui-sortable-now

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!