Jump to content

Is it possible to have a collapsable menu within a collapsable menu? - A FAQ show hide, within another show hide? +-

Recommended Posts

Hello squarespace community, 

I have made a page with a +- toggle foldout option. After the main 'head subject +'  I would like to make another list with new +- options that are not visible when the head section is not opened.

Underneath how I would like it to look / work: 

Head Subject + (always visible) 

After opening: 

Head Subject - 
               Secondary Subject + (Only visible when head subject is open) 
               Secondary Subject + (Only visible when head subject is open) 

After opening secondary subject

Head Subject - 
               Secondary Subject - (Only visible when head subject is open) 
               Information about the secondary subject
               Secondary Subject + (Only visible when head subject is open) 

Does anyone have an idea if this is possible? And how?  

My current page injection code: 

$(document).ready(function() {
$('.markdown-block .sqs-block-content h3, h4').addClass('ui-closed').css('cursor', 'pointer');
$('.markdown-block .sqs-block-content h3,h4').nextUntil('h3,h4').slideToggle();
$('.markdown-block .sqs-block-content h3,h4').click(function() {
if ($(this).nextUntil('h3,h4').is(':hidden')) {
$('.markdown-block .sqs-block-content h3,h4').nextUntil('h3,h4').slideUp();
$(".markdown-block .sqs-block-content h3,h4").removeClass('ui-open');
$(".markdown-block .sqs-block-content h3,h4").addClass('ui-closed');

$(this).toggleClass('ui-closed ui-open');}
$(this).toggleClass('ui-closed ui-open');}


Screenshot 2021-05-30 at 10.01.57.png

Edited by Rosemarie
Link to comment

I think above won't work in this case.

Try accordion plugin or choose a free code here & then share url, we will tweak it to work with Squarespace.

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
  • 8 months later...

Hi @Rosemarie

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 but you experienced some issues. 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.