FAQ

PHOTO EMBED

Tue Oct 26 2021 09:27:36 GMT+0000 (UTC)

Saved by @JureVidmar #javascript #jquery #html

<div class="faq__item-wrapper">
  {% for block in section.blocks %}
  {% case block.type %}
  {% when 'question_three' %}
  <div class="faq__item">
    <div class="faq-question">{{ block.settings.question }}</div>
    <div class="faq-answer">{{ block.settings.answer }}</div>
  </div>
  {% endcase %}
  {% endfor %}
</div>    
<script>
  $(document).ready(function(){
    $('.faq-question').click(function(){
      $(this).toggleClass('active');
      $(this).next('.faq-answer').toggleClass('active');
    });
  });
</script>
content_copyCOPY

Display answer on click