[英]bootstrap accordion : how to collapse all at a click
is there any option to collapse all the accordion when click on open or any other heading ? 单击打开或任何其他标题时,是否可以选择折叠所有手风琴?
for example click one the second heading all accordion should collapse. 例如,单击第二个标题,所有手风琴应折叠。 is it possible ?
可能吗 ?
DEMO http://plnkr.co/edit/OxbVII?p=preview 演示 http://plnkr.co/edit/OxbVII?p=preview
Your main issue is with your accordion-toggle
links. 您的主要问题是
accordion-toggle
链接。
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapseOne" href="#">
Should be 应该
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Notice the data-target
is not needed it instead goes into the href
but the data-parent
is added. 请注意,不需要
data-target
,而是将其放入href
但添加了data-parent
。 Needs to be done for all three links. 这三个链接都需要完成。
Example 例
http://plnkr.co/edit/VY7ETh?p=preview http://plnkr.co/edit/VY7ETh?p=preview
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.