我的引导手风琴表现得很有气质!我创建了三个面板显示在列网格中,但第二和第三个折叠菜单关闭了错误的菜单(例如,单击/打开menu2然后单击/打开menu3将关闭menu2,然后再打开menu3)。
知道为什么吗?
代码在这里:
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="panel-group">
<div class="panel panel-default">
<a class="panel-default" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<div class="panel-heading">
<h4 class="panel-title">
My Story
</h4>
</div>
</a>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
Content
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<a class="panel-default" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
<div class="panel-heading">
<h4 class="panel-title">
My Skills
</h4>
</div>
</a>
<div id="collapseTwo" class="panel-collapse collapse in">
<div class="panel-body">
Content
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<a class="panel-default" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
<div class="panel-heading">
<h4 class="panel-title">
My Ambition
</h4>
</div>
</a>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
content
</div>
</div>
</div>
</div>
</div>
</div>
答案 0 :(得分:29)
您需要为手风琴编号,即accordion1 accordion2 accordion3
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="panel-group">
<div class="panel panel-default">
<a class="panel-default" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne">
<div class="panel-heading">
<h4 class="panel-title">
My Story
</h4>
</div>
</a>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
Content
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<a class="panel-default" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
<div class="panel-heading">
<h4 class="panel-title">
My Skills
</h4>
</div>
</a>
<div id="collapseTwo" class="panel-collapse collapse in">
<div class="panel-body">
Content
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<a class="panel-default" data-toggle="collapse" data-parent="#accordion3" href="#collapseThree">
<div class="panel-heading">
<h4 class="panel-title">
My Ambition
</h4>
</div>
</a>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
content
</div>
</div>
</div>
</div>
</div>
</div>