Using only CSS, the bootstrap collapse icon can be changed using predefined icons:
a[aria-expanded=true] .glyphicon-plus { display: none; } a[aria-expanded=false] .glyphicon-minus { display: none; } .pointer{ cursor:pointer; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <a data-toggle="collapse" class="pointer" aria-expanded="false" data-target="#testCollpase" aria-controls="#testCollpase" > <span class="pull-left title-sidebar">Filter By Price</span> <span class="pull-right"><i class="glyphicon glyphicon-plus"></i></span> <span class="pull-right"><i class="glyphicon glyphicon-minus"></i></span> <div class="clearfix"></div> </a> <div id="testCollpase" class="collapse"> <ul> <li><a href="#">500$</a></li> <li><a href="#">1000$</a></li> </ul> </div>
In your HTML, add aria-expanded="false" and add the two icons that you need to set in the minimize panel. How,
<a data-toggle="collapse" class="pointer" aria-expanded="false" data-target="#testCollpase" aria-controls="#testCollpase" > <span class="pull-left title-sidebar">Filter By Price</span> <span class="pull-right"><i class="glyphicon glyphicon-plus"></i></span> <span class="pull-right"><i class="glyphicon glyphicon-minus"></i></span> </a>
And manage it from css. When the panel collapse expand, then
a[aria-expanded=true] .glyphicon-plus { display: none; }
otherwise it will be
a[aria-expanded=false] .glyphicon-minus { display: none; }
Run the snippet and I think you just need this ...
Maniruzzaman Akash Aug 14 '17 at 4:14 2017-08-14 04:14
source share