Jump to content

Markdown FAQs different section

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Hi @Ziggy that's what I was thinking too, but that actually doesn't work because then there is a big gap between each accordion when they are not open. 
This is the code I used:


<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h4').addClass('ui-closed').css('cursor','pointer');
$(".markdown-block .sqs-block-content h4").nextUntil("h4").slideToggle();
$(".markdown-block .sqs-block-content h4").click(function() {

$(this).nextUntil("h4").slideToggle();
$(this).toggleClass('ui-closed ui-open');
});
});
</script>

 

As in the attached picture, I thought it could work when I write the category without the #### but that doesn't work and the category get's hidden together with the answers.

 

Thank you!!

image.png

Link to comment
13 minutes ago, lucylou12 said:

.nextUntil("h4")

This is the problem, it contains everything from one H4 until the next H4. It's not been designed to have other titles in between, and I'm afraid I don't have an easy solution to change this. The only thing you could do is add the category as another H4 without anything after it, and then maybe make them bold? If you made them bold and italic you may be able to use that to target the category H4s.

Please like and upvote if my comments were useful to you. Thanks!

Zygmunt Spray
Squarespace Website Designer
Contact me: https://squarefortytwo.com/ 
🔌Ghost Squarespace Plugins (Referral link)
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.