document.addEventListener('DOMContentLoaded', function () { if (document.querySelector('.faq_section')) { let faqToggles = document.querySelectorAll('.faq_top'); faqToggles.forEach(function(toggle) { toggle.addEventListener('click', function() { const faqTop = this; const faqBody = faqTop.nextElementSibling; document.querySelectorAll('.faq_body').forEach(function(body) { if (body !== faqBody) { body.style.height = '0px'; body.classList.remove('open'); const otherArrow = body.previousElementSibling.querySelector('.faq_arr_down'); if (otherArrow) { otherArrow.classList.remove('rotate'); } } }); if (faqBody.classList.contains('open')) { faqBody.style.height = '0px'; } else { faqBody.style.height = `${faqBody.scrollHeight}px`; } faqBody.classList.toggle('open'); const faqArrow = faqTop.querySelector('.faq_arr_down'); if (faqArrow) { faqArrow.classList.toggle('rotate'); } }); }); } });