Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Collapsable FAQ on mobile


mackenzieu

Question

Site URL: https://carrot-bronze-bld8.squarespace.com/coop-curbside

Hello!

I was able to create a collapsible FAQ through a markdown block and the following code but the content does not collapse on mobile--any ideas how to resolve?

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

 

Thank you!

Link to comment

6 answers to this question

Recommended Posts

  • 0
On 9/23/2021 at 6:01 PM, mackenzieu said:

I was able to create a collapsible FAQ through a markdown block and the following code but the content does not collapse on mobile--any ideas how to resolve?

It doesn't work because of a Brine feature called Ajax Page Loading - a fantastic feature that makes Brine sites load more quickly.

You may not realise this, but the FAQ does not work for desktop visitors either. This is because the Ajax page loading feature gets disabled when you're logged on to your site. This can give you a flase sense of security. It's always a good idea to open a site in an Incognito window (without logging on) when you are testing it.

To prevent the FAQ issues, you'll want to change the code placement (place it in a Code Block within the page above the FAQ) or disable Ajax Page Loading altogether - although this will slow down the site. See my guide here: Why does Squarespace code only work on refresh?

Also you (and other readers) may want to note that the code snippet you've used is very old and uses an old version of jQuery that has known security vulnerabilities. You'll want to use the up-to-date version (currently 3.5.1 or 3.6.0).

  If this post has helped you, please click an icon below  ⬇️

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi! I'm Paul, an independent Squarespace Consultant since 2007 and founder of SF Digital, building the features that Squarespace didn't include. Our mini-extensions allow you to pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect . Links in my posts may refer to SF Digital products or may be affiliate links.

Link to comment
  • 0
11 hours ago, mackenzieu said:

it is still not collapsing on mobile

I'm not seeing that issue when I take a look.

345646824_Screenshot2021-10-19at12_10_18.thumb.png.8dc27e6e2763b83cb59895a21db7302e.png

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi! I'm Paul, an independent Squarespace Consultant since 2007 and founder of SF Digital, building the features that Squarespace didn't include. Our mini-extensions allow you to pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect . Links in my posts may refer to SF Digital products or may be affiliate links.

Link to comment
  • 0
10 minutes ago, mackenzieu said:

When I test it on my iPhone it's not functioning correctly

It's difficult for me to troubleshoot as it's good for me on iPhone too. 

collapsed-accordion.thumb.jpeg.38421dc381f636ca6edc244ab354a2db.jpeg

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi! I'm Paul, an independent Squarespace Consultant since 2007 and founder of SF Digital, building the features that Squarespace didn't include. Our mini-extensions allow you to pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect . Links in my posts may refer to SF Digital products or may be affiliate links.

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