正如您在小提琴中看到的那样,两个面板组可以同时打开。如果点击其中一个,怎么能让另一个崩溃呢?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container container-table">
<div class="row">
<div id="menucontainer" class="text-center col-lg-2 col-lg-offset-5">
<div class="panel-group" id="neubau">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<button id="accordion1" data-toggle="collapse" data-parent="#neubau" href="#collapseOne" class="btn btn-default">Neubau</button>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<ul class="list-group">
<li class="list-group-item"><button id="neuzupf" type="button" class="btn btn-default one">Zupfinstrumente</button>
</li>
<ul class="list-group">
<li class="list-group-item"><button id="neustreich" type="button" class="btn btn-default">Streichinstrumente</button></li></ul>
</ul>
</div>
</div>
</div>
<div class="panel-group" id="restaur">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<button id="accordion2" data-toggle="collapse" data-parent="#restaur" href="#collapseTwo" class="btn btn-default">Restaurierung</button>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<ul class="list-group">
<li class="list-group-item"><button id="restaurzupf" type="button" class="btn btn-default one">Zupfinstrumente</button>
</li>
<ul class="list-group">
<li class="list-group-item"><button id="restaurstreich" type="button" class="btn btn-default">Streichinstrumente</button></li></ul>
</ul>
</div>
</div>
</div>
&#13;
它似乎与数据父母有关,但我无法弄明白。 JQuery中的解决方案也没问题。谢谢!
答案 0 :(得分:1)
使两者的数据父级相同,因此它可以作为兄弟姐妹面板工作,并根据您的需要工作。