aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/+layout.svelte7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 78e08016..7f962884 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -39,6 +39,8 @@ import { toolsAsCommandPaletteActions } from "$lib/Tools/tools";
import localforage from "localforage";
import { dev } from "$app/environment";
import { injectAnalytics } from "@vercel/analytics/sveltekit";
+import Lenis from "lenis";
+import "lenis/dist/lenis.css";
import type { LayoutData } from "./$types";
injectSpeedInsights();
@@ -50,6 +52,7 @@ let isHeaderVisible = true;
let previousScrollPosition = 0;
let notificationInterval: ReturnType<typeof setInterval> | undefined =
undefined;
+let lenis: Lenis | undefined = undefined;
addMessages("en", english as unknown as LocaleDictionary);
addMessages("ja", japanese as unknown as LocaleDictionary);
@@ -94,6 +97,8 @@ const handleScroll = () => {
onMount(async () => {
if (browser) {
+ lenis = new Lenis({ autoRaf: true });
+
if (await localforage.getItem("redirect")) {
window.location.href = (await localforage.getItem("redirect")) ?? "/";
@@ -162,6 +167,8 @@ onDestroy(() => {
if (browser) window.removeEventListener("scroll", handleScroll);
if (notificationInterval) clearInterval(notificationInterval);
+
+ lenis?.destroy();
});
$: {