Jump to content

Accordion effect on my markdown block 'bounces' and I don't know why

Go to solution Solved by paul2009,

Recommended Posts

Site URL: https://www.shutupanddance.co/faq

Hello,

I have a markdown block on my FAQ page. When I tap the headings, the accordion 'bounces' open, closed, open – you can see what's happening here.

Here's a page where it is functioning fine (the accordion 'bounces' open until you close it again by tapping the header).

The coding for both markdown blocks is the same – I copy pasted the detail – so can't figure out what I'm doing wrong!

Any help would be appreciated, thank you.

Abby

Link to comment
2 hours ago, abbydamen said:

Site URL: https://www.shutupanddance.co/faq

Hello,

I have a markdown block on my FAQ page. When I tap the headings, the accordion 'bounces' open, closed, open – you can see what's happening here.

Here's a page where it is functioning fine (the accordion 'bounces' open until you close it again by tapping the header).

The coding for both markdown blocks is the same – I copy pasted the detail – so can't figure out what I'm doing wrong!

Any help would be appreciated, thank you.

Abby

You should only append the script only one time, I suggest place it on Code injection Footer

<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>

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
  • 3 weeks later...

Hiya! Thanks for your support here. 

I've tried putting the script in the footer only (via settings/advanced), but that makes both pages (/location and /faq) do the weird bounce effect...

I've tried putting the code in the advanced / header section of each page setting, but that ends up making the markdown not function at all (e.g. all text shows on /locations) and then still same bounce issue persists on /faq.

If this helps anyone else, I found injecting this code (on both pages (probably not best practice as you suggest @bangank36 !) in a code block has resolved my issue.

 

<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').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>

 

Thanks again

Abby

 

Link to comment
  • 2 months later...
  • Solution

Squarespace launched a new Accordion Block yesterday. This new native block doesn't require custom code and is therefore safer and easier to install.

spacer.png

It is ideal for FAQs and product specifications. You can choose and style the icon, add dividers and change row padding. For more information see Accordion blocks.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

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.