我的自举舞会表现出气质!我已经创建了三列显示在一个列网格中的面板,但第二和第三个折叠菜单关闭了错误的菜单(例如点击/打开菜单2,然后点击/打开菜单3将关闭菜单2,然后打开菜单3).
任何想法为什么?
代码在这里:
<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>
解决方法
您需要编号手风琴,即手风琴1手风琴2手风琴3
<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>