Task 1 | fix fix template bugs and layout
This commit is contained in:
@@ -168,11 +168,11 @@ window.addEventListener('DOMContentLoaded', function(){
|
||||
|
||||
if (document.querySelector('.faq')) {
|
||||
|
||||
let faqToggles = document.querySelectorAll('.faq_title, .faq_arr_down');
|
||||
let faqToggles = document.querySelectorAll('.faq_top');
|
||||
|
||||
faqToggles.forEach(function(toggle) {
|
||||
toggle.addEventListener('click', function() {
|
||||
const faqTop = this.closest('.faq_top');
|
||||
const faqTop = this;
|
||||
const faqBody = faqTop.nextElementSibling;
|
||||
|
||||
document.querySelectorAll('.faq_body').forEach(function(body) {
|
||||
@@ -203,6 +203,44 @@ window.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');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (document.querySelector('.photo_image')) {
|
||||
document.querySelectorAll('.photo_image input[type="file"]').forEach(input => {
|
||||
input.addEventListener('change', function() {
|
||||
|
||||
Reference in New Issue
Block a user