diff --git a/services/burka_wed/script.js b/services/burka_wed/script.js index 0a820f2..741f326 100644 --- a/services/burka_wed/script.js +++ b/services/burka_wed/script.js @@ -599,16 +599,6 @@ window.addEventListener('scroll', () => { // ---- FAQ: аккордеон ---- -function setFaqAnswerHeight(answer, open) { - if (open) { - answer.classList.add('open'); - answer.style.maxHeight = answer.scrollHeight + 'px'; - } else { - answer.classList.remove('open'); - answer.style.maxHeight = '0px'; - } -} - document.querySelectorAll('.faq-question').forEach(btn => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; @@ -616,21 +606,12 @@ document.querySelectorAll('.faq-question').forEach(btn => { document.querySelectorAll('.faq-question').forEach(b => { b.setAttribute('aria-expanded', 'false'); - setFaqAnswerHeight(b.nextElementSibling, false); + b.nextElementSibling.classList.remove('open'); }); if (!expanded) { btn.setAttribute('aria-expanded', 'true'); - setFaqAnswerHeight(answer, true); - } - }); -}); - -window.addEventListener('resize', () => { - document.querySelectorAll('.faq-question[aria-expanded="true"]').forEach(btn => { - const answer = btn.nextElementSibling; - if (answer.classList.contains('open')) { - answer.style.maxHeight = answer.scrollHeight + 'px'; + answer.classList.add('open'); } }); });