From 7c369794c1f112edc4b2272e9bad18f5bb53452b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Mon, 21 Mar 2022 14:05:54 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Scroll=20back=20to=20top=20when=20t?= =?UTF-8?q?ransition=20out=20is=20finished?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Potentially the end of nightmares for page transitions with `sveltekit:noscroll`? --- src/components/PageTransition.svelte | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/PageTransition.svelte b/src/components/PageTransition.svelte index 77cadab..74d05dd 100644 --- a/src/components/PageTransition.svelte +++ b/src/components/PageTransition.svelte @@ -7,22 +7,14 @@ export let name: string - onMount(async () => { - // Disable when changing filters on /photos and shop? - if (!$page.url.searchParams.get('country') && !$page.url.pathname.includes('/shop')) { - await tick() - setTimeout(() => { - // Scroll back to top between page transitions - scrollToTop() - }, DURATION.PAGE_DELAY) - } - }) + $: doNotScroll = !$page.url.searchParams.get('country') && !$page.url.pathname.includes('/shop')
doNotScroll && scrollToTop()} >
\ No newline at end of file