I am trying to keep my FAQ section close by default (refer image 2). Currently, it’s open by default (refer image 1) and if we just use one header in FAQ, I am unable to close/minimize it (like image 2). I need help on closing this section by defailt. Any help is appreciated, thank you.
Using Savon-theme
Website URL - https://straight-studio.com/pages/keratin-treatment
Section is at middle of this page.
image 1
image 2
Hi @StraightSample ,
I’m not sure this can work properly as I can’t directly edit it for you, however you can try the following:
- Online Store → Themes → Edit code
2, Find the theme.liquid file and add this code before the tag
<script>
document.querySelectorAll('.dt-sc-accordion-btn').forEach(btn => btn.addEventListener('click', () => {
btn.nextElementSibling.classList.toggle('hidden');
}))
window.addEventListener('load', function () {
document.querySelector('.dt-sc-accordion-content').classList.add('hidden');
})
</script>
Result:
Hope it’s useful to you
@StraightSample !
@BSS-Commerce Thank you so much. This code works for our site too.