简体   繁体   中英

why the nested sortable plugin not work in jquery?

I am using this plugin https://github.com/mjsarfatti/nestedSortable in fiddle it out put is some thing like this http://dbushell.github.io/Nestable/ But I insert that plugin in our fiddle it not work why ?

http://jsfiddle.net/3qtMt/

$(document).ready(function(){

        $('.sortable').nestedSortable({
            handle: 'div',
            items: 'li',
            toleranceElement: '> div'
        });

    });

Because you don't have any element of class sortable in the fiddle. You need to assign a class. Updated code: http://jsfiddle.net/lotusgodkk/3qtMt/1/

<div class="sortabled">    
<div>
<ol class="sortable">
    <li class="dd-item" data-id="1">
        <div class="dd-handle">Item 1</div>
    </li>
    <li class="dd-item" data-id="2">
        <div class="dd-handle">Item 2</div>
    </li>
    <li class="dd-item" data-id="3">
        <div class="dd-handle">Item 3</div>
        <ol class="dd-list">
            <li class="dd-item" data-id="4">
                <div class="dd-handle">Item 4</div>
            </li>
            <li class="dd-item" data-id="5">
                <div class="dd-handle">Item 5</div>
            </li>
        </ol>
    </li>
</ol>
</div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM