我有以下HTML:
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
如何让#nestedQuestionGroup
排序,而不是它内的孩子?来自jquery-ui的当前可排序函数使子项可以排序,而不是父本身。
答案 0 :(得分:0)
从jqueryui可排序小部件(http://api.jqueryui.com/sortable/)的基础文档中,您应该尝试这样做:
html:
<div id="parent-sortable">
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
<div class="nestedQuestionGroup">
<div class="formsection">
</div>
<div class="formsection">
</div>
</div>
</div>
js:
$( "#parent-sortable" ).sortable({
items: "> .nestedQuestionGroup"
});
您可以使用延迟,光标,不透明度,轴,类等许多选项来个性化您的可排序...
希望它有所帮助!