"Expandable Panel List with Arrow Change"
Bootstrap 3.3.0 Snippet by Pawan Sachitha Seram

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.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 ----------> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"> <div class="container"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Panel List Group with Expandable Setail Section</h3> </div> <ul class="list-group"> <li class="list-group-item"> <div class="row toggle" id="dropdown-detail-1" data-toggle="detail-1"> <div class="col-xs-10"> Item 1 </div> <div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div> </div> <div id="detail-1"> <hr></hr> <div class="container"> <div class="fluid-row"> <dt> Felis euismod semper eget lacinia </dt> <dd> Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </dd> </div> </div> </div> </li> <li class="list-group-item"> <div class="row toggle" id="dropdown-detail-2" data-toggle="detail-2"> <div class="col-xs-10"> Item 2 </div> <div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div> </div> <div id="detail-2"> <hr></hr> <div class="container"> <div class="fluid-row"> <dt> Felis euismod semper eget lacinia </dt> <dd> Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </dd> </div> </div> </div> </li> <li class="list-group-item"> <div class="row toggle" id="dropdown-detail-3" data-toggle="detail-3"> <div class="col-xs-10"> Item 3 </div> <div class="col-xs-2"><i class="fa fa-chevron-down pull-right"></i></div> </div> <div id="detail-3"> <hr></hr> <div class="container"> <div class="fluid-row"> <dt> Felis euismod semper eget lacinia </dt> <dd> Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </dd> </div> </div> </div> </li> </ul> </div> </div>
$(document).ready(function() { $('[id^=detail-]').hide(); $('.toggle').click(function() { $input = $( this ); $target = $('#'+$input.attr('data-toggle')); $target.slideToggle(); if($input.find('.col-xs-2 i').attr('class')=="fa fa-chevron-down pull-right") { $input.find('.col-xs-2 i').removeClass('fa-chevron-down'); $input.find('.col-xs-2 i').addClass('fa-chevron-up'); } else if($input.find('.col-xs-2 i').attr('class')=="fa pull-right fa-chevron-up") { $input.find('.col-xs-2 i').removeClass('fa-chevron-up'); $input.find('.col-xs-2 i').addClass('fa-chevron-down'); } else if($input.find('.col-xs-2 i').attr('class')=="fa pull-right fa-chevron-down") { $input.find('.col-xs-2 i').removeClass('fa-chevron-down'); $input.find('.col-xs-2 i').addClass('fa-chevron-up'); } }); });

Related: See More


Questions / Comments: