I'm creating a list using collapse
in an interaction of loop
, but they're all starting open, I'd like only the first item of my collapse
to be open.
If you double click on one of the items, it closes all the others, leaving only what was clicked.
My view
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
@for (int i = 0; i < 10; i++)
{
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading_@i">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_@i" aria-expanded="true" aria-controls="collapse_@i"
@{ if (i == 0) { <text> collapse</text>} else { <text></text>}}>
Collapsible Group Item #@i
</a>
</h4>
</div>
<div id="collapse_@i" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading_@i">
<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>
Edited as suggested by Luis.