我只想在 collapsiblecol1
之前更改 collapsible col2
的位置。最后的顺序应该是: 1.col2
2.col1
3.col3
<div data-role="content">
<div id="List" data-role="collapsible-set">
<div data-role="collapsible" data-content-theme="c" id="col1">
<h3>Header 1</h3>
<p>Text 1</p>
</div>
<div data-role="collapsible" data-content-theme="c" id="col2">
<h3>Header 2</h3>
<p>Text 2</p>
</div>
<div data-role="collapsible" data-content-theme="c" id="col3">
<h3>Header 3</h3>
<p>Text 3</p>
</div>
</div>
</div>
最佳答案
您应该移动可折叠部分,然后调用刷新:
$('#col1').after($('#col2')); // Move the node
$('#List').collapsibleset('refresh'); // Refresh the collapsible set
编辑:应该在 collapsibleset 插件中调用“refresh”方法(而不是在 collapsible 插件上)。 -感谢奥马尔的更正。
关于javascript - jqm 改变可折叠的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26524426/