-1
您在自舉中知道這種效果嗎? 當您單擊組1它切換,當你點擊第2組,第1個倒塌,這裏是例子:另一部手風琴內的可摺疊手風琴
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#title1">Title 1</a>
</h4>
</div>
<div id="title1" class="panel-collapse collapse in">
<div class="panel-body">
<div class="panel-group" id="accordion">
\t <div class="panel">
\t <a data-toggle="collapse" href="#title1-1">sub-title</a>
</div>
<div id="title1-1" class="panel-collapse collapse in">
\t <div class="panel-body">
\t <a href="#">Content</a><br>
<a href="#">Content</a><br>
<a href="#">Content</a><br>
<a href="#">Content</a>
</div>
</div>
<div class="panel">
\t <a data-toggle="collapse" href="#title1-2">sub-title 2</a>
</div>
<div id="title1-2" class="collapse">
\t <div class="panel-body">
\t <a href="#">Content</a><br>
<a href="#">Content</a><br>
<a href="#">Content</a><br>
<a href="#">Content</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#title2">Title 2</a>
</h4>
</div>
<div id="title2" class="panel-collapse collapse">
<div class="panel-body">
<!--- STUFF --->
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#title3">Title 3</a>
</h4>
</div>
<div id="title3" class="panel-collapse collapse">
<div class="panel-body">
<!--- STUFF --->
</div>
</div>
</div>
</div>
</div>
</body>
</html>
好涼,我想在「標題1內部列表「與外面的這3個列表具有相同的效果!
它不工作我想是因爲類和ID是不正確?