Jquery sortable plugin for unordered list multi dimension

我们两清 提交于 2019-12-12 05:14:02

问题


This is my list multi dimensiosn :

     <div id="tree">
    <ul>
    <li id="205">205
         <ul>
            <li id="206">206
                      <ul>
                        <li id="208">208</li>
                        <li id="209">209</li>
                        <li id="211">211
                             <ul><li id="212">212</li>
                                 <li id="213">213</li>
                            </ul>
                        </li>
                      </ul>
             </li>

    <li id="207">207
                      <ul>
                         <li id="210">210</li>
                      </ul>
            </li>
      </ul>
</li>
</ul>
</div>

When using Jquery plugin sortable , i can only drag and drop elements which they are in the same 'ul' tag , for exemple , if i drag the "212" tag and i dropped it after "213" tag , the plugin works fine , but if i drag "212" tag and i drop it after "206" , it did'nt work .

here is my function :

 $("#tree ul").sortable({ 

         opacity: 0.6, 
         cursor: 'move',
         containment : '#tree',
         grid : [10, 10]


         });

thinks for help .


回答1:


You should use connectWith: .someClass feature in jQueryUI. Its in the documentation. Here is your jsfiddle example updated.



来源:https://stackoverflow.com/questions/18315391/jquery-sortable-plugin-for-unordered-list-multi-dimension

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