Jump to content

Squarespace Courses Accordion Set To Always Closed

Recommended Posts

Hi; with the new "courses" feature, there is a built-in feature to have an accordion toggle to show and hide the modules under the chapter headings. As you can see below.

Screenshot2023-11-02at7_40_04am.thumb.png.487ed57fe30f0c50e090d4b246ecf1e8.png

 

However, they are always open when you go into the course. For a different course, there will be many many modules, and I want to hide them all under their accordion heading by default. I was wondering if there is CSS code that I could use to allow one specific course to have its accordion headings closed by default?

Thank you so much!

Screenshot2023-11-02at7_38_12am.png.2e84fce41f1170719addb28fe118a39b.png

Link to comment
  • 4 months later...
On 4/9/2024 at 5:19 AM, jallory said:

Hi @tuanphan thank you. Here is an example of one of the pages where I would like to make this fix https://www.wiseheartpdx.org/mcd-competencies-5-6-recognizing-managing-reactivity

You can use this code to Website > Website Tools > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
 jQuery(document).ready(function($){
  $('.course-list__list-chapter-item-accordion-content[aria-hidden="false"]').attr('aria-hidden','true');
})
</script>

 

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

@tuanphan Thank you very much! This works! It's just a little confusing for users because the accordion down content won't show unless they click more than once. If there's a fix for that, it would be much appreciated. But, I am happy to have some sort of solution regardless! 🙏 🙏 🙏

Link to comment
On 4/19/2024 at 4:33 AM, jallory said:

@tuanphan Thank you very much! This works! It's just a little confusing for users because the accordion down content won't show unless they click more than once. If there's a fix for that, it would be much appreciated. But, I am happy to have some sort of solution regardless! 🙏 🙏 🙏

Add this code under

<style>
  [data-expanded] section {
    height: auto !important;
}
[data-expanded] section[aria-hidden="true"] {
    height: 0 !important;
}
</style>

 

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
On 4/21/2024 at 1:17 AM, tuanphan said:

Add this code under

<style>
  [data-expanded] section {
    height: auto !important;
}
[data-expanded] section[aria-hidden="true"] {
    height: 0 !important;
}
</style>

 

Hi @tuanphan thank you very much for your response and this offer. However, it isn't making a change. 

Link to comment
On 4/24/2024 at 9:33 PM, jallory said:

Hi @tuanphan thank you very much for your response and this offer. However, it isn't making a change. 

It works, but you need double click...

You can remove all code, I will test it again

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

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.