对其下方的内容进行可折叠扩展

时间:2014-04-27 21:45:24

标签: jquery jquery-mobile jquery-mobile-collapsible

我正在尝试创建一个可折叠的文件,当它展开时,应该滚动它下面的内容。因此,它下面的内容保持不变。

 <div data-role="collapsible">
     <h3>Content of collapsible</h3>
     <ul data-role="listview">
         <li>I'm the collapsible set content.</li>
         <li>I should roll over the data beneath me.</li>
     </ul>
 </div>
 <div>
     <p>I'm data underneath.</p>
     <p>I should remain in place when the collapsible is unfolded.</p>
 </div>

示例代码: http://jsfiddle.net/3swM6/

可能我正在使用错误的方法来实现这一目标。

2 个答案:

答案 0 :(得分:1)

要达到此效果,您需要设置要“坚持”的内容的位置。

这是一个有效的例子: http://jsfiddle.net/jakemulley/xU6Pv/

我使用了以下CSS:

.hider .ui-collapsible-content {
    position: absolute;
    width: 100%;
}

希望我帮忙!

答案 1 :(得分:1)

您只需要在jQueryMobile生成的可折叠内容上使用这些CSS规则:

position: absolute;
width: 100%;

以下是来自你的jsfiddle的工作示例:http://jsfiddle.net/3swM6/1/

相关问题