From 8341d343d376d21447f0a98957e445e680a10ad0 Mon Sep 17 00:00:00 2001 From: venashial Date: Tue, 26 Jul 2022 13:32:09 -0700 Subject: [PATCH] Fix noScroll & add prefetch to `NavRow` --- src/components/NavRow.svelte | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/NavRow.svelte b/src/components/NavRow.svelte index ee225c22..3fbb839d 100644 --- a/src/components/NavRow.svelte +++ b/src/components/NavRow.svelte @@ -13,7 +13,7 @@ /** Query param name to use (to not use queries, leave this prop blank) */ export let query = '' - export let resetScroll = false + export let noScroll: true | null = null /** Path level in URL, zero-indexed */ export let level = 0 @@ -96,12 +96,10 @@ : level === 0 ? link.href : basePath + link.href} - on:click={() => { - if (resetScroll) document.body.scrollTo(0, 0) - }} class="navigation__link" class:is-active={index === activeIndex} - sveltekit:noscroll={!resetScroll || null} + sveltekit:noscroll={noScroll} + sveltekit:prefetch bind:this={linkElements[index]}> {link.label}