"Collapsible Panel (with builtin collapse)"
Bootstrap 3.1.0 Snippet by adamjgomez

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" data-target="#collapseOne"> <h4 class="panel-title"> <a class="accordion-toggle"> Collapsible Group Item #1 </a> </h4> <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span> </div> <div id="collapseOne" class="panel-collapse collapse in"> <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title" data-toggle="collapse" data-parent="#accordion" data-target="#collapseTwo"> <a class="accordion-toggle"> Collapsible Group Item #2 </a> </h4> <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span> </div> <div id="collapseTwo" class="panel-collapse collapse"> <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title" data-toggle="collapse" data-parent="#accordion" data-target="#collapseThree"> <a class="accordion-toggle"> Collapsible Group Item #3 </a> </h4> <span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span> </div> <div id="collapseThree" class="panel-collapse collapse"> <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> </div>
.row{ margin-top:40px; padding: 0 10px; } .clickable{ cursor: pointer; } .panel-heading span { margin: -26px 15px 0 0; font-size: 15px; } .panel-heading { cursor: pointer; } .panel-heading a { display: block; padding: 10px 15px; } .panel-heading { padding: 0; } .panel-default>.panel-heading { color: #333; background-color: pink; border-color: #ddd; }
$(document) .on('click', '.panel-heading span.clickable', function(e){ $(this).parents('.panel').find('.panel-collapse').collapse('toggle'); }) .on('show.bs.collapse', '.panel-collapse', function () { var $span = $(this).parents('.panel').find('.panel-heading span.clickable'); $span.find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); }) .on('hide.bs.collapse', '.panel-collapse', function () { var $span = $(this).parents('.panel').find('.panel-heading span.clickable'); $span.find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down'); })

Related: See More


Questions / Comments: