JQuery嵌套可排序手风琴

栏目: jQuery · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/9203244/jquery-nested-sortable-accordion
我正在为JQuery使用 http://mjsarfatti.com/sandbox/nestedSortable/

嵌套排序.我想让每个人都能成为手风琴.我已经达到了嵌套可 排序 和手风琴的程度;但是,每当我将任何可排序项拖到左侧时,整个应用程序就会冻结.

这是我的JS(运行正常):

$('ol.sortable').nestedSortable({
    disableNesting: 'no-nest',
    forcePlaceholderSize: true,
    handle: 'div',
    helper: 'clone',
    items: 'li',
    maxLevels: 10,
    opacity: .6,
    placeholder: 'placeholder',
    revert: 250,
    tabSize: 25,
    tolerance: 'pointer',
    toleranceElement: '> div'                   
});

$(function() {
    var stop = false;
    $( "#accordion h3" ).click(function( event ) {
         if ( stop ) {
            event.stopImmediatePropagation();
            event.preventDefault();
            stop = false;
            }
    });
    $( "#accordion" )
            .accordion({
            header: "> ol > li > div > h3"
    })
            .nestedSortable({
            axis: "y",
            handle: "h3",
            stop: function() {
            stop = true;
                    }
            });
    });

这是html:

<section id="accordion"> 
    <ol class="sortable"> 
        <li id="list_1">
            <div>
                <h3><a href="#">Header</a></h3>
                <div>
                    <p>des fields.</p>
                </div>
        </div>
        <li id="list_2"><div>Item 2</div> 
        <ol> 
            <li id="list_3"><div>Sub Item 2.1</div> 
            <li id="list_4"><div>Sub Item 2.2</div> 
            <li id="list_5"><div>Sub Item 2.3</div> 
            <li id="list_6"><div>Sub Item 2.4</div> 
        </ol>   
    </ol>
</section>

这绝对是一个问题,只有在将手风琴与sortables一起使用时才会出现.有人遇到过这个问题吗?

你可能想试试
$('ol.sortable').nestedSortable({ options }).accordion({accordion options});

翻译自:https://stackoverflow.com/questions/9203244/jquery-nested-sortable-accordion


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

Programming in Haskell

Programming in Haskell

Graham Hutton / Cambridge University Press / 2007-1-18 / GBP 34.99

Haskell is one of the leading languages for teaching functional programming, enabling students to write simpler and cleaner code, and to learn how to structure and reason about programs. This introduc......一起来看看 《Programming in Haskell》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试