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

@@ -8,7 +8,7 @@
import { getContext, onMount } from 'svelte'
import { timeline, stagger } from 'motion'
import { DELAY } from '$utils/contants'
import { smoothScroll } from '$utils/functions'
import { smoothScroll } from '$utils/stores'
import { getAssetUrlKey } from '$utils/api'
import reveal from '$animations/reveal'
import { quartOut } from '$animations/easings'
@@ -105,7 +105,7 @@
{settings.description}
</p>
<Button url="#locations" text="Explore locations" on:click={event => smoothScroll({ hash: 'locations', event })}>
<Button url="#locations" text="Explore locations" on:click={() => $smoothScroll.scrollTo('#locations', { duration: 2 })}>
<IconEarth animate={true} />
</Button>
</div>