From f7fde3a46820e2386759e35f36a8bac3d0ceca91 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Wed, 19 Mar 2025 22:17:18 +0800 Subject: [PATCH] feat: active outline link scroll to page center --- src/client/theme-default/composables/outline.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/theme-default/composables/outline.ts b/src/client/theme-default/composables/outline.ts index 74e72a0f..e3396f25 100644 --- a/src/client/theme-default/composables/outline.ts +++ b/src/client/theme-default/composables/outline.ts @@ -170,6 +170,10 @@ export function useActiveAnchor( activeLink.classList.add('active') marker.value.style.top = activeLink.offsetTop + 39 + 'px' marker.value.style.opacity = '1' + activeLink.scrollIntoView({ + block: 'center', + inline: 'nearest' + }) } else { marker.value.style.top = '33px' marker.value.style.opacity = '0'