docs: Tweak TOC rootMargin parameter

To take into account the top header.
This commit is contained in:
Ryan Gossiaux
2022-03-07 12:08:17 -08:00
parent 4bc81d38f4
commit 1bf36a1bf2
2 changed files with 3 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
import TocItems, { type TocItem } from "./_TocItems.svelte"; import TocItems, { type TocItem } from "./_TocItems.svelte";
export let el: HTMLElement | null; export let el: HTMLElement | null;
export let rootMargin = "0% 0% -80% 0%";
let runWithCleanup = createRunWithCleanup(); let runWithCleanup = createRunWithCleanup();
let activeId: string | undefined; let activeId: string | undefined;
@@ -55,7 +56,7 @@
} }
}); });
}, },
{ rootMargin: `0% 0% -80% 0%` } { rootMargin }
); );
}); });

View File

@@ -28,7 +28,7 @@
class="sticky top-0 pt-20 pb-4 -mt-[61px] max-h-screen overflow-y-auto" class="sticky top-0 pt-20 pb-4 -mt-[61px] max-h-screen overflow-y-auto"
> >
{#key $page} {#key $page}
<TableOfContents {el} /> <TableOfContents {el} rootMargin="-61px 0% -85% 0%" />
{/key} {/key}
</nav> </nav>
</div> </div>