• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Template Expressions - Trying to use _isFirst

New Here ,
Jan 17, 2020 Jan 17, 2020

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

TOPICS
Code , How to , Other

Views

443

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2020 Jan 17, 2020

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>
Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 21, 2020 Jan 21, 2020

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines