diff --git a/src/lib/utils/scroll.ts b/src/lib/utils/scroll.ts index d9c30160b3..b3e392a408 100644 --- a/src/lib/utils/scroll.ts +++ b/src/lib/utils/scroll.ts @@ -18,6 +18,20 @@ export const createScrollInfo = () => { let lastDirChange = 0; onMount(() => { + const handleInitialAnchor = () => { + if (window.location.hash) { + const anchorElement = document.querySelector(window.location.hash); + if (anchorElement) { + return window.pageYOffset + anchorElement.getBoundingClientRect().top; + } + } + return 0; + }; + + const initialTop = handleInitialAnchor(); + scrollInfo.set({ direction: 'down', top: initialTop, deltaDirChange: 0 }); + lastDirChange = initialTop; + const handleScroll = () => { scrollInfo.update((p) => { const top = window.scrollY; diff --git a/src/routes/pricing/+page.svelte b/src/routes/pricing/+page.svelte index c87cea06a7..9f5a84ff17 100644 --- a/src/routes/pricing/+page.svelte +++ b/src/routes/pricing/+page.svelte @@ -64,7 +64,7 @@ >