我需要你的帮助来语法扩展Jquery的可折叠div
我已经尝试了许多选项
这是我的小提琴
http://jsfiddle.net/jWaEv/20/
我试过以下
<div data-role="content" class="data">
<div class="my-collaspible" id="first" data-inset="false" data-role="collapsible">
<h3>Header 1</h3>
<p>Content</p>
<p>Content</p>
</div>
<div class="my-collaspible" id="second" data-inset="false" data-role="collapsible">
<h3>Header 2</h3>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>
$(document).ready(function() {
var id = 'first';
$("#" + id).trigger('expand').collapsible("refresh");
});
你能告诉我怎么做吗??
您可以使用这个:
http://jsfiddle.net/jWaEv/37/
<div data-role="collapsible-set">
<div id="first" data-role="collapsible">
<h3>Header 1</h3>
<p>Content</p>
<p>Content</p>
</div>
<div id="second" data-role="collapsible">
<h3>Header 2</h3>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>
<input type="button" value="Test" id="btn1" />
和JS:
$(document).ready(function() {
$("#first").collapsible('expand');
//test
$('#btn1').click(function(){
$("#first").collapsible('collapse');
});
});
("#myCollapsible").collapsible("expand");
当我使用jQuery 1.11.1和JQM 1.4.5 时,这对我有效
使用以下选项:collapsible
,
$("#" + id).collapsible( "option", "collapsed", false );
更新的Fiddle