mirror of
https://github.com/youwen5/site.git
synced 2024-11-28 10:53:50 -08:00
fix: don't trigger navigation loader if going to external link
This commit is contained in:
parent
b75f2c7085
commit
692907a11d
1 changed files with 6 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
|||
import { onMount } from 'svelte'
|
||||
import { afterNavigate, beforeNavigate } from '$app/navigation'
|
||||
import Loading from '$lib/components/Loading.svelte'
|
||||
import type { BeforeNavigate } from '@sveltejs/kit'
|
||||
|
||||
let root: HTMLElement | null
|
||||
let navigating = false
|
||||
|
@ -22,9 +23,11 @@
|
|||
navigating = false
|
||||
})
|
||||
|
||||
beforeNavigate(() => {
|
||||
beforeNavigate((navigation: BeforeNavigate) => {
|
||||
if (navigation.to?.url.origin === window.location.origin) {
|
||||
navigating = true
|
||||
root?.classList.remove('smoothscroll')
|
||||
}
|
||||
})
|
||||
|
||||
afterNavigate(() => {
|
||||
|
|
Loading…
Reference in a new issue