accordion contain many different sections. so you can collapse or expand the sections. Only one section can be opened at one time.
<!-- accordion -->
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Accordion</h2>
<div class="panel-group" id="accordion">
<!-- section 1 -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#section1">
Question 1
</a>
</div>
<div class="panel-collapse collapse in" id="section1"> <!-- "in" class will expand the section when first loaded. test yourself by removing it -->
<div class="panel-body">
This will contain some text.....
</div>
</div>
</div>
<!-- section 2 -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#section2">
Question 2
</a>
</div>
<div class="panel-collapse collapse" id="section2"> <!-- "in" class will expand the section when first loaded. test yourself by removing it -->
<div class="panel-body">
This will contain some text.....
</div>
</div>
</div>
<!-- section 3 -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#section3">
Question 3
</a>
</div>
<div class="panel-collapse collapse" id="section3"> <!-- "in" class will expand the section when first loaded. test yourself by removing it -->
<div class="panel-body">
This will contain some text.....
</div>
</div>
</div>
</div>
</div>
</div>
</div>
DEMO:
<!-- accordion -->
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Accordion</h2>
<div class="panel-group" id="accordion">
<!-- section 1 -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#section1">
Question 1
</a>
</div>
<div class="panel-collapse collapse in" id="section1"> <!-- "in" class will expand the section when first loaded. test yourself by removing it -->
<div class="panel-body">
This will contain some text.....
</div>
</div>
</div>
<!-- section 2 -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#section2">
Question 2
</a>
</div>
<div class="panel-collapse collapse" id="section2"> <!-- "in" class will expand the section when first loaded. test yourself by removing it -->
<div class="panel-body">
This will contain some text.....
</div>
</div>
</div>
<!-- section 3 -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#section3">
Question 3
</a>
</div>
<div class="panel-collapse collapse" id="section3"> <!-- "in" class will expand the section when first loaded. test yourself by removing it -->
<div class="panel-body">
This will contain some text.....
</div>
</div>
</div>
</div>
</div>
</div>
</div>
DEMO:
fig: Accordion with Bootstrap |
No comments:
Post a Comment