1
I’m creating a list using the collapse
in an interaction of loop
, but are all starting open, I would like only the first item of my collapse
stay open.
If you double-click on one of the items, it closes all the others, leaving open only the one that 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 at Luis' suggestion.
@rman, I’m no expert on css, but I think I’ve made my point with what I’ve added to the response.
– Pablo Tondolo de Vargas
So, it’s more so the answer doesn’t get so "dry" anyway. Surely the explanation now helps (: - (I will delete my comments to not "dirty" the answer).
– Renan Gomes