I recently worked with Bootstrap 4 and could not figure out where the class name was "in" (it is mentioned in several answers to similar questions).
After a long search, I noticed updated documentation that states:
The collapse plugin uses several classes for working with heavy loads:
.collapse hides content
.collapse.show shows the content
.collapsing is added when the transition starts and is deleted when the transition ends.
So, the sample code now looks something like this:
<div id="accordion"> <div class="card"> <div class="card-header" id="headingOne"> <h5 class="mb-0"> <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Collapsible Group Item #1 </button> </h5> </div> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div class="card-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>
From which, it is important a little:
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
Removing the class name "show" ensures that the default Bootstrap accordion remains collapsed.
Hope this helps!
source share