From 7f695d273d8212a18c66e4c383bdb6cfd140e124 Mon Sep 17 00:00:00 2001 From: Freeze455 Date: Wed, 6 Oct 2021 21:06:15 +0200 Subject: [PATCH] :construction: Work in progress --- src/components/Documentation.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Documentation.vue b/src/components/Documentation.vue index a7e4f20..1545b1e 100644 --- a/src/components/Documentation.vue +++ b/src/components/Documentation.vue @@ -155,9 +155,10 @@ import { documentation } from '../utils/Navigation' import { CalendarIcon, ChartBarIcon, FolderIcon, HomeIcon, InboxIcon, MenuIcon, UsersIcon, XIcon, MenuAlt2Icon } from '@heroicons/vue/outline' const sidebarOpen = ref(false) - let toc = ref([]) + onMounted(() => { + window.scroll(0, top + 20) setTimeout(() => { const elements = document.querySelectorAll('h2, h3') toc.value = Array.from(elements).map((element: HTMLElement) => ({ @@ -166,14 +167,14 @@ onMounted(() => { .toLowerCase() .replace(/ /g, '-') })) - }, 200) + }, 300) }) function scrollMeTo (refName: string) { const element = document.getElementById(refName) - const top = element.offsetTop; + const top = element.offsetTop - window.scroll(0, top + 20); + window.scroll(0, top) }