Jump to content

Accordion/toggle style only on page refresh

Recommended Posts

Hello! I have been googling my heart out trying to find a solution.  I have the Avenue template and have some content for visitors to toggle and I used markdown

and in the page header code injection i have: 

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
    $(document).ready(function(){
    $('.markdown-block .sqs-block-content h3').addClass('ui-closed').css('cursor','pointer');
    $(".markdown-block .sqs-block-content h3").nextUntil("h3").slideToggle();
    $(".markdown-block .sqs-block-content h3").click(function() {
      
      $(this).nextUntil("h3").slideToggle();
      $(this).toggleClass('ui-closed ui-open');
      });
    });
    </script>

It works when I click on the refresh button but not if I go to the page itself from another tab. I have to hit refresh in order for it the content to be hidden. It does the same on mobile. What am I missing? Do you need any other info from me? The page in question: https://www.brightsideup.org/find-child-care

Thank you all in advance. 

Link to comment
  • Replies 2
  • Views 1.2k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.