faq block and arrows

This commit is contained in:
shahboz
2024-09-08 14:19:37 +05:00
parent cc7b5c4091
commit 804d1c68ad
16 changed files with 115 additions and 122 deletions

View File

@@ -166,42 +166,42 @@ window.addEventListener('DOMContentLoaded', function(){
closeModalOnClick('.modal .plus', '.modal');
closeModalOnClick('.modal_back', '.modal');
// if (document.querySelector('.faq')) {
if (document.querySelector('.faq')) {
// let faqToggles = document.querySelectorAll('.faq_title, .faq_arr_down');
let faqToggles = document.querySelectorAll('.faq_title, .faq_arr_down');
// faqToggles.forEach(function(toggle) {
// toggle.addEventListener('click', function() {
// const faqTop = this.closest('.faq_top');
// const faqBody = faqTop.nextElementSibling;
faqToggles.forEach(function(toggle) {
toggle.addEventListener('click', function() {
const faqTop = this.closest('.faq_top');
const faqBody = faqTop.nextElementSibling;
// document.querySelectorAll('.faq_body').forEach(function(body) {
// if (body !== faqBody) {
// body.style.height = '0px';
// body.classList.remove('open');
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');
// }
// }
// });
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`;
// }
if (faqBody.classList.contains('open')) {
faqBody.style.height = '0px';
} else {
faqBody.style.height = `${faqBody.scrollHeight}px`;
}
// faqBody.classList.toggle('open');
faqBody.classList.toggle('open');
// const faqArrow = faqTop.querySelector('.faq_arr_down');
// if (faqArrow) {
// faqArrow.classList.toggle('rotate');
// }
// });
// });
// }
const faqArrow = faqTop.querySelector('.faq_arr_down');
if (faqArrow) {
faqArrow.classList.toggle('rotate');
}
});
});
}
if (document.querySelector('.photo_image')) {
document.querySelectorAll('.photo_image input[type="file"]').forEach(input => {