Skip to content
Snippets Groups Projects
Commit 5af63edc authored by Liliana Sanfilippo's avatar Liliana Sanfilippo
Browse files

if (scrollToId) {

            const element = document.getElementById(scrollToId);
            if (element) {
                const viewportHeight = window.innerHeight;
                const targetPosition = element.getBoundingClientRect().top + window.pageYOffset;
                const scrollToPosition = targetPosition - viewportHeight / 2 + element.clientHeight / 2;
                window.scrollTo({ top: scrollToPosition, behavior: "smooth" });
            }
        }
parent f72dad56
No related branches found
No related tags found
Loading
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment