Use Lenis to use smooth scroll to anchors

This commit is contained in:
2022-09-19 20:09:28 +02:00
parent f37a84d4f3
commit 486213ac77
7 changed files with 80 additions and 129 deletions

View File

@@ -6,8 +6,8 @@
import { navigating } from '$app/stores'
import { getContext, onMount } from 'svelte'
import { stagger, timeline } from 'motion'
import { smoothScroll } from '$utils/stores'
import { cartOpen } from '$utils/stores/shop'
import { smoothScroll } from '$utils/functions'
import { DELAY } from '$utils/contants'
import { quartOut } from '$animations/easings'
// Components
@@ -117,7 +117,7 @@
<ul data-sveltekit-noscroll data-sveltekit-prefetch>
{#each shopLocations as { name, slug }}
<li class:is-active={product && slug === product.location.slug}>
<a href="/shop/poster-{slug}" on:click={() => smoothScroll({ hash: 'poster' })}>
<a href="/shop/poster-{slug}" on:click={() => $smoothScroll.scrollTo('#poster', { duration: 2 })}>
{name}
</a>
</li>