Skip to content

Commit

Permalink
Removed unused lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakesh9100 authored Dec 16, 2024
1 parent c4062cf commit f64380a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions assets/faq/faq.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,13 @@ faq.forEach((item) => {
allFaqs.forEach((content) => {
if (content !== faqContent) {
content.style.height = "0px"; // Collapse others
content.parentNode
.querySelector(".plus")
.style.transform = "none"; // Reset plus icon
content.parentNode.querySelector(".plus").style.transform = "none"; // Reset plus icon
}
});

// Toggle current FAQ
const isOpen = faqContent.style.height !== "0px";
faqContent.style.height = isOpen ? "0px" : faqContent.scrollHeight + "px";
faqItem.querySelector(".plus").style.transform = isOpen ?
"none" :
"rotate(45deg)";
faqContent.style.height = isOpen ? "0px" : `${faqContent.scrollHeight}px`;
faqItem.querySelector(".plus").style.transform = isOpen ? "none" : "rotate(45deg)";
});
});

faqItem.addEventListener(`click`, toggleContent);
document.querySelectorAll(`.faqs_container`)[index % 2].appendChild(faqItem);
});

0 comments on commit f64380a

Please sign in to comment.