From 534dca0b28879a3146ede6d8b4a37d3b45952f1e Mon Sep 17 00:00:00 2001 From: Swapnamayee Sahoo Date: Tue, 21 Nov 2023 14:36:28 +0530 Subject: [PATCH 1/2] 95: transition issue fixed --- blocks/accordion/accordion.css | 2 +- blocks/accordion/accordion.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/blocks/accordion/accordion.css b/blocks/accordion/accordion.css index aa152dfe..b1d7dc62 100644 --- a/blocks/accordion/accordion.css +++ b/blocks/accordion/accordion.css @@ -75,7 +75,7 @@ main .accordion.faq-accordion .faq-answer { overflow: hidden; font-size: 16px; max-height: 0; - transition: all 0.5s ease-in-out; + transition: all 0.3s ease-in-out; text-align: left; } diff --git a/blocks/accordion/accordion.js b/blocks/accordion/accordion.js index ffc8317b..54a450ca 100644 --- a/blocks/accordion/accordion.js +++ b/blocks/accordion/accordion.js @@ -63,7 +63,10 @@ export default function decorate(block) { const openfaq = block.querySelector('.faq-question.active'); if (openfaq && !currentFaq) { openfaq.classList.toggle('active'); - openfaq.nextElementSibling.classList.toggle('active'); + openfaq.nextElementSibling.style.maxHeight = 0; + setTimeout(() => { + openfaq.nextElementSibling.classList.toggle('active'); + }, 300); } const faqAnswer = e.currentTarget.nextElementSibling; e.currentTarget.classList.toggle('active'); From 82ff0f92b0f92fc41424c3dd1861c12069d60f90 Mon Sep 17 00:00:00 2001 From: Swapnamayee Sahoo Date: Tue, 21 Nov 2023 17:39:00 +0530 Subject: [PATCH 2/2] 95: transition effect issue fixed --- blocks/accordion/accordion.css | 2 +- blocks/accordion/accordion.js | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/blocks/accordion/accordion.css b/blocks/accordion/accordion.css index b1d7dc62..19cd3f3b 100644 --- a/blocks/accordion/accordion.css +++ b/blocks/accordion/accordion.css @@ -75,7 +75,7 @@ main .accordion.faq-accordion .faq-answer { overflow: hidden; font-size: 16px; max-height: 0; - transition: all 0.3s ease-in-out; + transition: all 0.4s ease-in-out; text-align: left; } diff --git a/blocks/accordion/accordion.js b/blocks/accordion/accordion.js index 54a450ca..7b2f65e1 100644 --- a/blocks/accordion/accordion.js +++ b/blocks/accordion/accordion.js @@ -68,17 +68,19 @@ export default function decorate(block) { openfaq.nextElementSibling.classList.toggle('active'); }, 300); } - const faqAnswer = e.currentTarget.nextElementSibling; - e.currentTarget.classList.toggle('active'); - if (e.currentTarget.classList.contains('active')) { - faqAnswer.classList.toggle('active'); - faqAnswer.style.maxHeight = `${faqAnswer.scrollHeight}px`; - } else { - faqAnswer.style.maxHeight = 0; - setTimeout(() => { + setTimeout(() => { + const faqAnswer = e.target.nextElementSibling; + e.target.classList.toggle('active'); + if (e.target.classList.contains('active')) { faqAnswer.classList.toggle('active'); - }, 300); - } + faqAnswer.style.maxHeight = `${faqAnswer.scrollHeight}px`; + } else { + faqAnswer.style.maxHeight = 0; + setTimeout(() => { + faqAnswer.classList.toggle('active'); + }, 300); + } + }, 300, e); }); const faqAnswer = [...row.children][1]; faqAnswer.classList.add('faq-answer');