Sindbad~EG File Manager

Current Path : /home/j/u/l/julesbu/www/wp-content/themes/Jules_Belamy/scripts/
Upload File :
Current File : /home/j/u/l/julesbu/www/wp-content/themes/Jules_Belamy/scripts/faq.js

window.addEventListener("load", () => {
  const faqItems = document.querySelectorAll(".single-article__faq-item");

  faqItems.forEach((item) => {
    item.addEventListener("click", () => {
      const answer = item.querySelector(".single-article__faq-answer");

      item.classList.toggle("active");
      // Max height of the answer
      const maxHeight = answer.scrollHeight;

      // If the answer is open
      if (answer.style.maxHeight) {
        // Close the answer
        answer.style.maxHeight = null;
      } else {
        // Open the answer
        answer.style.maxHeight = maxHeight + "px";
      }
    });
  });
});

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists