From 7fed6047ae60416a1c91a070d42e124bf5d99421 Mon Sep 17 00:00:00 2001 From: TeshuKatepalli Date: Tue, 26 Dec 2023 21:45:33 +0530 Subject: [PATCH] Updated the scroller issue --- blocks/accordion/accordion.js | 4 +++- styles/Typo.css | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/blocks/accordion/accordion.js b/blocks/accordion/accordion.js index 202e2c75..46d154e6 100644 --- a/blocks/accordion/accordion.js +++ b/blocks/accordion/accordion.js @@ -53,9 +53,10 @@ export default function decorate(block) { ele.remove(); } }); - faqRows.forEach((row) => { + faqRows.forEach((row, index) => { const faqQuestion = [...row.children][0]; faqQuestion.classList.add('faq-question'); + faqQuestion.id = `faq-question-${index}`; faqQuestion.addEventListener('click', (e) => { const currentFaq = e.currentTarget.classList.contains('active'); const openfaq = block.querySelector('.faq-question.active'); @@ -64,6 +65,7 @@ export default function decorate(block) { openfaq.nextElementSibling.style.maxHeight = 0; setTimeout(() => { openfaq.nextElementSibling.classList.toggle('active'); + faqQuestion.scrollIntoView({ behavior: 'smooth' }); }, 300); } setTimeout(() => { diff --git a/styles/Typo.css b/styles/Typo.css index 1e3bfc0b..da463283 100644 --- a/styles/Typo.css +++ b/styles/Typo.css @@ -6,7 +6,7 @@ html { scroll-behavior: smooth; - scroll-padding-top: 120px; + scroll-padding-top: 150px; } .img-colorbox-popup::after,