Jump to content

Header Code Injection in Blog Post

Recommended Posts

Hi, I am trying to add a dropdown using the markdown option on a specific blog post (to display Sources). I have followed the steps here: https://fallonmade.com/blog/accordion-dropdown-squarespace-css but I don't know where to put the page header code in so the dropdown actually works? I tried the blog advanced settings and also tried uploading as code block in the blog post but it doesn't seem to be working.

Link to comment
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Step1 + 2. Try this code, add to Page Header

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h2').css('cursor','pointer');
$(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle();
$(".markdown-block .sqs-block-content h2").click(function() {$(this).nextUntil("h2").slideToggle();});
});
</script>

then continue with step 3,4..

You can also consider this accordion plugin. Less code, easy to install/customize

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
1 hour ago, tuanphan said:

Step1 + 2. Try this code, add to Page Header


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h2').css('cursor','pointer');
$(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle();
$(".markdown-block .sqs-block-content h2").click(function() {$(this).nextUntil("h2").slideToggle();});
});
</script>

then continue with step 3,4..

You can also consider this accordion plugin. Less code, easy to install/customize

 

To which page header? I am working with blog posts, they don't have page header CSS section..

Link to comment
On 6/7/2021 at 8:44 PM, charlineca said:

To which page header? I am working with blog posts, they don't have page header CSS section..

Blog Page Header

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.