Jump to content

How to do accordion/toggle for FAQs, etc.?

Recommended Posts

18 hours ago, tuanphan said:

For future comments, to use @DV2 code, add a Code Block >> Paste this code

 

This worked great! But how do I remove the padding on mobile? It looks like the attached pic now. 

Tried to add the following but didn't change anything:

@media screen and (max-width:767px) {
  #block-yui_3_17_2_1_1633265646658_24065 {
   padding-left: 0;
    padding-right: 0;
}
  }

Screenshot 2021-10-04 at 11.11.03 AM.png

Link to comment
12 hours ago, bluepeach said:

This worked great! But how do I remove the padding on mobile? It looks like the attached pic now. 

Tried to add the following but didn't change anything:

@media screen and (max-width:767px) {
  #block-yui_3_17_2_1_1633265646658_24065 {
   padding-left: 0;
    padding-right: 0;
}
  }

Screenshot 2021-10-04 at 11.11.03 AM.png

For display purposes I gave the accordion a fairly narrow width. Try replacing the first line of CSS with this. 
It will expand to the width of the container, aka be responsive.
 

.accordion{width:100%; margin:2em auto;}

 

Link to comment
10 hours ago, DV2 said:

For display purposes I gave the accordion a fairly narrow width. Try replacing the first line of CSS with this. 
It will expand to the width of the container, aka be responsive.

Perfect! Thank you so much. 

Link to comment
  • 3 weeks later...
4 hours ago, DavidCliff said:

This works great for me on desktop, but when I click the "question" on mobile it skips to the top of the page. Any ideas? I presume it's something to do with: href="#"

Can you share your site with protected password for easier checking?

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
On 1/15/2017 at 5:18 AM, dizzyd said:

I discovered that Squarespace doesn't have any accordion/toggle styling that can be used for FAQs, etc. I was directed to come here and ask how to do it. I was hoping to have something that looks like this (see attached image)./storage/temp/4657-zzz305-20170114-1412.jpg

zzz305-20170114-1412.jpg.58137a4c03efd3c228befbdb1efddd98.jpg

Squarespace updated an Accordion Block. Now you can add it without using custom code

accordion1.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 3 weeks later...
  • 3 months later...

Hi @dizzyd

I see that you were looking for a solution to create an accordion on your site and may have used some custom code to try to create it. I'm happy to say that should you want to add an accordion to your site without additional code, you can do so using the accordion block! We have some information about the possibilities and customizations of the accordion block in our guide "Accordion blocks" should you want to take a look. Happy site building!

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.