You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
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');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
}); |