Copy link to clipboard
Copied
I'm trying to use the repeating region for a set of accordians which is currently working. Now I'm trying to get it setup to where the first accorion tab is open when coming to the page. While trying to use "_isFirst" I seem to be having trouble getting it to work properly.
Here is the code that I'm using in the template:
<!-- TemplateBeginRepeat name="Accordian" -->
<article class="card card-custom card-corporate">
<div class="card-header" id="accordion1Heading@@(_index + 1)@@" role="tab">
<div class="card-title"><a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion1" href="#accordion1Collapse@@(_index + 1)@@" aria-controls="accordion1Collapse1@@(_index + 1)@@" aria-expanded="true"><h2><!-- TemplateBeginEditable name="AccordianTitle" -->Accordian Title<!-- TemplateEndEditable --></h2>
<div class="card-arrow"></div>
</a> </div>
</div>
<div class="collapse" id="accordion1Collapse@@(_index + 1)@@" role="tabpanel" aria-labelledby="accordion1Heading@@(_index + 1)@@">
<div class="card-body"><!-- TemplateBeginEditable name="AccordianBody" -->Accordian Body<!-- TemplateEndEditable --></div>
</div>
</article>
<!-- TemplateEndRepeat -->
Any help would be greatly appreciated!
Thanks in advance,
mh
Copy link to clipboard
Copied
Add a bit of script to the bottom of your document where INDEX is the panel that you want to be open:
<script>
$('#accordion1Collapse(INDEX)').collapse('toggle')
</script>
Copy link to clipboard
Copied
That doesn't seem to work, or at least I can't get it to work. But, I'm also not sure that would work for what we're trying to do/use it for. Since this will reside in a template and will control mutliple pages with different names on the accordions/ tabs. I hope this make sense. Any thoughts about using the _isFirst DW expression?
THanks again!
Copy link to clipboard
Copied
Prehaps there's some Javascript that could be used that says something like "if first accordion, active/open?"
I'm just not sure how to go about this, any thoughts???
Thanks again!