Fix Page transitions and scroll back to top

Might fix all the issues so far!
- start page loading on entering page transition start
- scroll back to top on leaving page transition end
This commit is contained in:
2022-10-11 23:53:03 +02:00
parent ff2aa2f030
commit dd57ea968e
3 changed files with 15 additions and 12 deletions

View File

@@ -2,13 +2,13 @@
import '../style/global.scss'
import { browser } from '$app/environment'
import { navigating, page } from '$app/stores'
import { page } from '$app/stores'
import { beforeNavigate } from '$app/navigation'
import { PUBLIC_ANALYTICS_KEY, PUBLIC_ANALYTICS_URL } from '$env/static/public'
import type { PageData } from './$types'
import { onMount, setContext } from 'svelte'
import { pageLoading, previousPage } from '$utils/stores'
import '$utils/polyfills'
import { PUBLIC_ANALYTICS_KEY, PUBLIC_ANALYTICS_URL } from '$env/static/public'
// Components
import SVGSprite from '$components/SVGSprite.svelte'
import SmoothScroll from '$components/SmoothScroll.svelte'
@@ -43,10 +43,6 @@
$previousPage = from.url.pathname
})
// Define page loading from navigating store
navigating.subscribe((store: any) => {
store && ($pageLoading = true)
})
onMount(() => {
// Avoid FOUC