javascript - jqm 改变可折叠的位置

标签 javascript jquery jquery-mobile position jquery-mobile-collapsible

我只想在 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/

相关文章:

javascript - Slidingbar.js动画不流畅

javascript - Canvas 形状缩放

javascript - jQuery 动画转换为 angularJS

javascript - 如何识别被点击的图片?

jquery-mobile - 如何在 knockout.js 初始化期间显示 "loader"?

javascript - 卡斯珀JS : Why does my url change to about:blank when my page is loaded?

javascript - 根据其他单元格的值更改javascript中表格单元格的颜色

java - 操作从 servlet 传递的 jsp 页面上的列表

javascript - 我自己的提示窗口会停止 javascript 执行吗?

javascript - 选择其他按钮时,JQuery Mobile 单选按钮保持选中状态。使用 .html 函数