Skip to main content
Participant
January 17, 2020
Question

Template Expressions - Trying to use _isFirst

  • January 17, 2020
  • 1 reply
  • 545 views

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

This topic has been closed for replies.

1 reply

BenPleysier
Community Expert
Community Expert
January 17, 2020

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>
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
m_169Author
Participant
January 22, 2020

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!

m_169Author
Participant
January 28, 2020

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!