The next-generation file converter. Open source, fully local* and free forever.
fix: navbar highlight zoooooomin
Maya850c4ae6ce29
diff --git a/src/lib/components/layout/Navbar/Base.svelte b/src/lib/components/layout/Navbar/Base.svelteindex 4c39066..9c73db5 100644--- a/src/lib/components/layout/Navbar/Base.svelte+++ b/src/lib/components/layout/Navbar/Base.svelte@@ -64,6 +64,7 @@let links = $state<HTMLAnchorElement[]>([]);let container = $state<HTMLDivElement>();let containerRect = $derived(container?.getBoundingClientRect());+ let isInitialized = $state(false);const linkRects = $derived(links.map((l) => l.getBoundingClientRect()));@@ -73,6 +74,16 @@const isSecretPage = $derived(selectedIndex === -1);+ $effect(() => {+ if (containerRect && linkRects.length > 0 && links.length > 0) {+ setTimeout(() => {+ isInitialized = true;+ }, 10);+ } else {+ isInitialized = false;+ }+ });+beforeNavigate((e) => {const oldIndex = items.findIndex((i) =>i.activeMatch(e.from?.url.pathname || ""),@@ -157,7 +168,7 @@<div bind:this={container}><Panel class="max-w-[778px] w-screen h-20 flex items-center gap-3 relative">{@const linkRect = linkRects.at(selectedIndex) || linkRects[0]}- {#if linkRect}+ {#if linkRect && isInitialized}<divclass="absolute bg-panel-highlight rounded-xl"style="width: {linkRect.width}px; height: {linkRect.height}px; top: {linkRect.top -