gmoye
May 16, 2024, 9:55pm
1
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:
Go to Store Online-> theme → edit code
Assets/global.js
Find “summary.addEventListener(‘click’, (event) => {”
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
gmoye
May 17, 2024, 6:47pm
3
Thank you, that worked! Is it possible to keep the smooth motion when content opens? Thanks again.