jQuery UI Sortable dynamic fixed items

前端 未结 1 1802
遇见更好的自我
遇见更好的自我 2021-01-23 09:03

I need some help with getting some items to stay in place in a jquery UI sortable.

I know about JQuery sortable lists and fixed/locked items and it does work quite nicel

相关标签:
1条回答
  • 2021-01-23 09:09

    You can make container element sortable so that you will not have to worry about new elements:

    Demo

    HTML:

    <ul id="container">
        <li>1</li>
        <li class="fixed">2</li>
        <li>3</li>
        <li class="fixed">4</li>
        <li>5</li>
    </ul>
    

    JS:

     $("#container").sortable();
    
    0 讨论(0)
提交回复
热议问题