Chrome Extension

Auto collapse accordion AMP

If you add an expand-single-section attribute to the AMP accordion then all other sections will auto-collapse except the active section that has been clicked.
<amp-accordion class="myaccordion" expand-single-section>
  <section>
    <h4>Section 1</h4>
    <p>Content of Section 1</p>
  </section>
  <section>
    <h4>Section 2</h4>
    <p>Content od Section 2</p>
  </section>
</amp-accordion>
Code faster with devsheet chrome extension and increase productivity as a programmer
search code from your favorite search engine instantly.
Install Now

Search Index Data (The code snippet can also be found with below search text)

Show active section only AMP accordion
Was this helpful?
0 Comments
Open Code Manager We are hiring