jQuery可排序列表占位符问题

时间:2018-07-05 04:20:03

标签: jquery jquery-ui

我有一个可排序的列表。我已经设法归类为多层次的。但是,当将来自第一层深度的元素插入第二层深度时,占位符将保持剧烈运行。

$('.sortable').sortable({ 
    connectWith:    '.sortable',
    cursor:         'move',
    placeholder:    'sortable-placeholder',
    handle:         '.block-title',
    cursorAt:       { left: 150, top: 17 },
    /*tolerance:      'pointer',*/
    scroll:         false,
    zIndex:         9999,
});
$('.sortable').disableSelection();

这是我的fiddle

1 个答案:

答案 0 :(得分:1)

这似乎与特定版本的jquery / jquery ui有关。在jquery-1.9.1/ui-1.9.2上,闪烁的问题消失了:

https://jsfiddle.net/x2dnmL0j/


更新: 如果您无法摆脱旧的jquery,则可以并行使用旧/新的jquery版本。新的jquery将在另一个名称空间下访问。参见:jquery.noconflict

<head>
    <title></title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

    <script>
    //This means that jquery  declared first  will be maintained with standard namespace and last one will get the name $3.
    var $3 = jQuery.noConflict(true)

    console.log("old:",$.fn.jquery, $.ui.version)
    console.log("new:",$3.fn.jquery, $3.ui.version)

    </script>

</head>
相关问题