我必须将子元素放入另一个子元素中。我使用了disableSelection(),但是子元素不接受另一个子元素。
$(function() {
$( "ul.droptrue" ).sortable({
connectWith: "li"
});
$("#sortable, #sortable1").disableSelection();
});
这里jdfiddle链接:http://jsfiddle.net/thilakar/QNkEL/7/
答案 0 :(得分:0)
HTML:
<div id="tree">
<ul id="createTree" class="droptrue">
<li class="listTree ui-state-default" id="sortable">Title1
<ul class="droptrueInner">
<li class="innerList ui-state-default">Green</li>
<li class="innerList ui-state-default">Yellow</li>
<li class="innerList ui-state-default">Black</li>
<li class="innerList ui-state-default">White</li>
</ul>
</li>
<li class="listTree1 ui-state-default" id="sortable1">Title2
<ul class="droptrueInner">
<li class="innerList ui-state-default">Violet</li>
<li class="innerList ui-state-default">purple</li>
<li class="innerList ui-state-default">Pink</li>
<li class="innerList ui-state-default">Orange</li>
</ul>
</li>
</ul>
使用Javascript:
$(function() {
$( "ul.droptrue" ).sortable({
connectWith: "ul.droptrue"
});
$( "ul.droptrueInner" ).sortable({
connectWith: "ul.droptrueInner"
});
});