структура1.js 647 B

12345678910111213141516171819202122
  1. function toggleFAQSection(section) {
  2. const title = section.querySelector('.faq-title');
  3. const faqQuestions = section.querySelector('.faq-questions');
  4. const plusIcon = section.querySelector('.fas');
  5. faqQuestions.style.display = faqQuestions.style.display === 'block' ? 'none' : 'block';
  6. plusIcon.classList.toggle('fa-minus');
  7. }
  8. function initFAQ() {
  9. const faqSections = document.querySelectorAll('.faq-section');
  10. faqSections.forEach(section => {
  11. title.addEventListener('click', () => {
  12. toggleFAQSection(section);
  13. });
  14. });
  15. }
  16. module.exports = { toggleFAQSection, initFAQ };