How to make an accordion dropdown in Squarespace

Insert this code into the ADVANCED part of the age settings.

<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 h2').addClass('ui-closed').css('cursor','pointer');
$(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle();
$(".markdown-block .sqs-block-content h2").click(function() {

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

Then in the page, create a MARKDOWN section and For the headlines put ## in front of it.

Example:

+ Headline

Content


Photos used

  • Taken from Unsplash, just search like Detroit / Abandoned and they will show up