Scrolling to the top of an open accordion on title click

Shopify Partner
2 0 0

Hey there,

I want to be able to scroll to the top of an open accordion on title click below is the block from  the Broadcast theme we are using, is this possible?

      <div class="accordion_wrapper" data-section-id="{{ }}" data-section-type="faq" data-aos="hero" data-aos-anchor="{{ animation_anchor }}" data-aos-order="{{forloop.index}}" {{ block.shopify_attributes }}>     
        {%- for block in section.blocks -%}                      
        {%- assign title = block.settings.title -%}
        {%- assign text = block.settings.text -%}
        {%- if title != blank and text != blank -%}        
        <div class="accordion" data-accordion>
          <h4 class="accordion__title standard__rte font--3" data-focus-element tabindex="0" data-accordion-toggle data-block-id="{{ }}-{{forloop.index}}">
            <i class="fa fa-regular fa-square-plus"></i>
            <i class="fa fa-regular fa-square-minus"></i>
            {{ title }}
          <div class="rte accordion__body standard__rte  font--3" data-accordion-body>{{ text }}</div>
        {%- endif -%}
        {%- endfor -%}            

 So that when I am clicking on an H4 Title it should scroll to the active accordion div

Replies 0 (0)