Jump to content

Markdown Accordion background color when open only

Recommended Posts

Site URL: https://www.urbanvoguedayspa.com.au/trial

Hi guys, I'm having issues making my accordion background color change when open, currently it's the opposite of what I want, the colour of the heading changes when clicked, I want the contents of the accordion to change color when clicked. I think I would need to change the script which I don't really know how to do, can someone help?  Picture is an example of what I want it to look like




Here's the script: 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script><script>
$('.markdown-block .sqs-block-content h3').addClass('ui-closed').css('cursor','pointer');
$(".markdown-block .sqs-block-content h3").nextUntil("h3").slideToggle();
$(".markdown-block .sqs-block-content h3").click(function() {

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

Here's the css: 


//markdown block for treatments

.markdown-block p {
  padding-right: 16px;
  .markdown-block h3 {
font-weight: 300 !important;

.markdown-block .ui-closed:before {
  content:"+ ";

.markdown-block .ui-open:before {
  content:"- ";
  .markdown-block {padding:20px;
  margin: 0 auto;
  width: 100% !important;
.ui-open {
 background-color: #d2c8c2 !important;}

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images


Why you don't use Accordion Block to add accordion, instead of using Markdown + Script code

to change background, try adding this to Design > Custom CSS

h3.ui-open ~ * {
    background-color: #f1f2f3;
    margin-top: 0;
    margin-bottom: 0;


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.