Bootstrap折叠-全部展开 [英] Bootstrap Collapse - Expand All
本文介绍了Bootstrap折叠-全部展开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经实现了Bootstrap 3折叠。单击任一标题链接时,客户端希望所有目标块都展开。我试图实施此答案的修改版本,但无法使其正常工作。
I've implemented Bootstrap 3 Collapse. The client wants all of the target blocks to expand when any one of the heading links is clicked. I have tried to implement a modified version of this answer, but can't get it working.
如何单击所有目标块以使其展开/折叠?
How can I get all target blocks to expand/collapse when any one of them is clicked?
这是标记:
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h6 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse{entry_id}">{title}</a></h6>
</div>
</div>
<div id="collapse{entry_id}" class="panel-collapse collapse">
<div class="panel-body">
{technology_body}
</div>
</div>
</div>
这是我尝试过的JS:
$('#accordion').on('click', function() {
if($('.collapse:not(.in)')) {
$.collapse("toggle");
}
});
推荐答案
我在此问题上获得了一些离线帮助。使用的脚本是
I got some help offline on this question. The script to use is
$('#accordion .panel-default').on('click', function () {
$('#accordion .panel-collapse').collapse('toggle');
});
这是JSFiddle示例 http://jsfiddle.net/gtowle/Vq6gt/1/
and this is the JSFiddle example http://jsfiddle.net/gtowle/Vq6gt/1/
这篇关于Bootstrap折叠-全部展开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文