Jump to content

Markup Not Collapsing Despite Adding the code recommended in other forum Posts

Go to solution Solved by paul2009,

Recommended Posts

Site URL: https://greenmountainssolar.com/

I have a markdown block which wasn't collapsing until I researched this forum and found a new code to use. Using the recommended code, the clock does collapse/expand once., but only immediately after I edit and save the respective page. It then reverts back to keeping the markdown in the expanded position. The code block is on each page, not the header. This is the code I copied in:

<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
<script>
     $(document).ready(function(){
    $('.markdown-block .sqs-block-content h3').css('cursor','pointer');
    $(".markdown-block .sqs-block-content h3").nextUntil("h3").slideToggle();
    $(".markdown-block .sqs-block-content h3").click(function() {$(this).nextUntil("h3").slideToggle();});
    });
</script>

Web capture_11-2-2022_134645_liam-madden-7pl8.squarespace.com.jpeg

Link to comment
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Did you know there's a built in Accordion Block that doesn't require code?

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment

Hi Paul, Yes I initially tried the accordian and found it less elegant. I find the accordian is very appropriate for short FAQs because closing the question you're on is simple. But for longer form information, the accordian will disorient the reader by going to the bottom of the text and forces them to scroll back up to close it.

 

Link to comment
  • Solution
21 minutes ago, LiamMadden said:

Using the recommended code, the clock does collapse/expand once., but only immediately after I edit and save the respective page.

Disable Ajax Page Loading in Site Styles🙂

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.