[英]Bootstrap nested collapsable panels
I am using this code ( http://bootsnipp.com/user/snippets/OeaKO ) here to implement collapsable bootstrap panels. 我在这里使用此代码( http://bootsnipp.com/user/snippets/OeaKO )来实现可折叠的引导程序面板。
I tried to add other collapsable panels inside that ones, but it doesn't work properly. 我尝试在其中添加其他可折叠面板,但它无法正常工作。
Here is my actual HTML-Code
for the nested collapsable panels: 这是嵌套可折叠面板的实际
HTML-Code
:
<div class="panel panel-primary">
<div class="panel-heading clickable">
<h3 class="panel-title">Online-Shopping Partner</h3>
<span class="pull-right "><i class="glyphicon glyphicon-minus"></i></span>
</div>
<div class="panel-body">
<div class="panel panel-primary">
<div class="panel-heading clickable">
<h3 class="panel-title">Übersicht</h3>
<span class="pull-right "><i class="glyphicon glyphicon-minus"></i></span>
</div>
<div class="panel-body">
Panel content
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading clickable">
<h3 class="panel-title">Export</h3>
<span class="pull-right "><i class="glyphicon glyphicon-minus"></i></span>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div>
</div>
The JavaScript/CSS
code is the same as the one on the 'bootsnip'
-link above. JavaScript/CSS
代码与上面'bootsnip'
上的代码相同。
In the jQuery code you provided, add the following css class to both "inner" panels: 在您提供的jQuery代码中,将以下css类添加到“内部”面板:
panel-collapsed
And replace all occurences of 并取代所有出现的
$this.parents
With 同
$this.closest
There are a few things that are missing from the example you are posting to have nested collapsible panels. 您发布的示例中有一些缺少嵌套可折叠面板的内容。 Take a look at some of the properties that are needed to identify which PANEL you want to collapse with data-xxxx tags on this page:
在此页面上查看使用data-xxxx标记识别要折叠的PANEL所需的一些属性:
http://www.w3schools.com/bootstrap/bootstrap_collapse.asp http://www.w3schools.com/bootstrap/bootstrap_collapse.asp
By adding those tags you know exactly what DIV you will be expanding/collapsing. 通过添加这些标签,您可以准确地知道您将要扩展/折叠的DIV。
This is a working example already posted by somebody else: 这是一个已经由其他人发布的工作示例:
http://jsfiddle.net/n2fole00/6JyFr/4/ http://jsfiddle.net/n2fole00/6JyFr/4/
Pay attention to the data-toggle and href attributes in the example 请注意示例中的data-toggle和href属性
<div class="panel-heading">
<h4 class="panel-title">
<a class="panel-toggle" data-toggle="collapse" data-parent="#accordionYear" href="#collapseJune">
2014
</a>
</h4>
</div>
<!-- Here we insert another nested accordion -->
<div id="collapseJune" class="panel-body collapse">
<div class="panel-inner">
<div class="panel-group" id="accordionJune">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="panel-toggle" data-toggle="collapse" data-parent="#accordionJune" href="#collapseDay">
June
</a>
</h4>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.