Wrapp group of

PHOTO EMBED

Wed Nov 10 2021 12:11:42 GMT+0000 (UTC)

Saved by @JureWeConvert #javascript

<div class="product__description--long">
<h5></h5>
<p></p>
<p></p>
<p></p>
<p></p>
<h5></h5>
<p></p>
<p></p>
<p></p>
<h5></h5>
<p></p>
</div>
<script>
  $(document).ready(function(){
    var desTitles = $('.product__description--long h5');
    for(var i= 1; i<=desTitles.length; i++) {
      var wrapSelector = $('.product__description--long h5:nth-of-type('+i+')').nextUntil('.product__description--long h5:nth-of-type('+(i+1)+')');
      wrapSelector.wrapAll("<div class='accordion-description__text'></div>")
      var checkTitle = $('.product__description--long h5:nth-of-type('+i+')');
      checkTitle.addClass('accordion-description__title')
      if(checkTitle.text() == '') {
      	checkTitle.css('display','none');
      }
    }
    
    $('.product__description--long h5').click(function(){
      $(this).toggleClass('active');
      $(this).next().toggleClass('active');
    });

  });
</script>
content_copyCOPY

SkinnyMe Tea

https://skinnyme-tea.myshopify.com/admin/themes/120650203213?key