pull/3654/merge
Bobbie Goede 6 months ago committed by GitHub
commit a8f35dc2ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { useScrollLock } from '@vueuse/core'
import { inBrowser } from 'vitepress'
import { ref, watch } from 'vue'
import { nextTick, onMounted, ref, watch } from 'vue'
import { useSidebar } from '../composables/sidebar'
import VPSidebarGroup from './VPSidebarGroup.vue'
@ -35,6 +35,11 @@ watch(
},
{ deep: true }
)
// scroll active link into view
onMounted(() => {
nextTick(() => navEl.value?.querySelector('.is-active')?.scrollIntoView({ block: 'center'}))
})
</script>
<template>

@ -168,6 +168,7 @@ export function useActiveAnchor(
if (activeLink) {
activeLink.classList.add('active')
activeLink.scrollIntoView({ behavior: 'smooth', block: 'center' })
marker.value.style.top = activeLink.offsetTop + 39 + 'px'
marker.value.style.opacity = '1'
} else {

Loading…
Cancel
Save