aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-05-08 07:47:47 +0000
committerFuwn <[email protected]>2026-05-08 07:47:47 +0000
commita69b12642237844e60bef7cb8abac7cbd074b53b (patch)
treeaf03b84a664d054add03d988ef48ee8ab75fc0e9 /src/routes
parentfeat(scroll): add global smooth scrolling via Lenis (diff)
downloaddue.moe-a69b12642237844e60bef7cb8abac7cbd074b53b.tar.xz
due.moe-a69b12642237844e60bef7cb8abac7cbd074b53b.zip
fix(scroll): route LandingHero scroll-down through Lenis
Lenis disables native CSS smooth scroll, so window.scrollTo({behavior:"smooth"}) jumps instantly. Expose the Lenis instance via a store and scroll through it, falling back to native when unavailable.
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/+layout.svelte5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 7f962884..fa0f4a25 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -41,6 +41,7 @@ import { dev } from "$app/environment";
import { injectAnalytics } from "@vercel/analytics/sveltekit";
import Lenis from "lenis";
import "lenis/dist/lenis.css";
+import lenisStore from "$stores/lenis";
import type { LayoutData } from "./$types";
injectSpeedInsights();
@@ -99,6 +100,8 @@ onMount(async () => {
if (browser) {
lenis = new Lenis({ autoRaf: true });
+ lenisStore.set(lenis);
+
if (await localforage.getItem("redirect")) {
window.location.href = (await localforage.getItem("redirect")) ?? "/";
@@ -169,6 +172,8 @@ onDestroy(() => {
if (notificationInterval) clearInterval(notificationInterval);
lenis?.destroy();
+
+ lenisStore.set(undefined);
});
$: {