Task 1 | fix fix template bugs and layout

This commit is contained in:
2024-09-09 08:42:01 +03:00
parent 804d1c68ad
commit 8c51488478
53 changed files with 1730 additions and 920 deletions

View File

@@ -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() {