Sense Theme - Make collapsible content open one at a time

Hi,

I am trying to make the collapsible content on my support page so it only allows one open at a time. I have tried every other similar thread I can find but no code seems to work. I am on Sense theme 2.0.

Site is nicegals.myshopify.com

Pass: test

Thank you!

Hi @gmoye ,

May I suggest to update code these steps:

  1. Go to Store Online-> theme → edit code

  1. Assets/global.js

  2. Find “summary.addEventListener(‘click’, (event) => {”

  3. Add code below likes the screenshot

document.querySelectorAll('[id^="Details-"] summary').forEach((sum) => {
     sum.setAttribute('aria-expanded', false);
    })
    document.querySelectorAll('[id^="Details-"]').forEach((details) => {
     details.removeAttribute('open');
    })

2 Likes

Thank you, that worked! Is it possible to keep the smooth motion when content opens? Thanks again.