Shopify themes, liquid, logos, and UX
Hi, I'm having trouble with my FAQ. I want answers to automatically close when someone clicks on a new question. (only one answer open at a time). I'm using the whisk theme, and here is a link to the page in question: https://www.brandroastsupply.com/pages/faq
Any help would be appreciated, Thanks!
Hey,
search for questions.liquid and paste it or paste it in theme.liquid just before the closing </body> tag
<script>
const faqs = document.querySelectorAll('details');
faqs.forEach((faq) => {
faq.addEventListener('click', function() {
faqs.forEach((otherFaq) => {
if (otherFaq !== faq) {
otherFaq.removeAttribute('open');
}
});
});
});
</script>
Hi @coffeesolutions,
You want it to be grouped, like 'WHO ARE WE AND WHO ARE WE FOR?' or 'OUR COFFEE' or whatever question is displayed, the other question will be closed?
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025