使用 jQuery Mobile,可折叠集( Accordion ?)中的面板可以默认打开吗?例如,在页面加载时打开第二个面板“标题 2”。我没有找到任何这方面的信息,并且想基于 URL 参数来执行此操作。
这是我目前拥有的 html:
<div data-role="collapsible-set">
<div data-role="collapsible" data-theme="c" data-content-theme="b">
<h3>Title 1</h3>
<div>Text 1 inside here</div>
</div>
<div data-role="collapsible" data-theme="c" data-content-theme="b">
<h3>Title 2</h3>
<div>Text 2 is here</div>
</div>
<div data-role="collapsible" data-theme="c" data-content-theme="b">
<h3>Title 3</h3>
<div>Text 3 inside this div</div>
</div>
</div>
这里还有一个 fiddle :
最佳答案
工作示例:http://jsfiddle.net/Gajotres/Qm3wb/
属性:data-collapsed="false"
官方文档:http://api.jquerymobile.com/collapsible/#option-collapsed
<div data-role="collapsible-set">
<div data-role="collapsible" data-theme="c" data-content-theme="b" data-collapsed="false">
<h3>Title 1</h3>
<div>Text 1 inside here</div>
</div>
<div data-role="collapsible" data-theme="c" data-content-theme="b">
<h3>Title 2</h3>
<div>Text 2 is here</div>
</div>
<div data-role="collapsible" data-theme="c" data-content-theme="b">
<h3>Title 3</h3>
<div>Text 3 inside this div</div>
</div>
</div>
关于javascript - jQuery Mobile - 使用 URL 参数打开可折叠集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16553905/