jqm更改可折叠的位置

jqm change position of collapsible

本文关键字:位置 可折叠 jqm      更新时间:2023-09-26

我只想在可折叠的col1之前更改可折叠col2的位置。最后,顺序应该是:1。CCD_ 3 2。CCD_ 4 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>

您应该移动可折叠的,然后调用refresh:

$('#col1').after($('#col2')); // Move the node
$('#List').collapsibleset('refresh'); // Refresh the collapsible set

已编辑:"刷新"方法应在collapsibleset插件中调用(而不是在可折叠插件上)-感谢Omar的更正。