From b38cf017f392c0c899d98afee89767ce21cc4cdd Mon Sep 17 00:00:00 2001 From: Ryan Coulson Date: Thu, 29 Feb 2024 16:36:43 -0500 Subject: [PATCH] fix anchor links --- src/components/story/story-content.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/story/story-content.vue b/src/components/story/story-content.vue index 263b6e19..600a257c 100644 --- a/src/components/story/story-content.vue +++ b/src/components/story/story-content.vue @@ -59,9 +59,12 @@ const activeChapterIndex = ref(-1); onMounted(() => { const hash = route?.hash.substring(1); if (hash) { - const decodedHash = decodeURIComponent(hash); - const el = document.getElementById(decodedHash); - el?.scrollIntoView({ behavior: 'smooth' }); + // Wait for a short period of time and then jump to the anchor. + setTimeout(() => { + const decodedHash = decodeURIComponent(hash); + const el = document.getElementById(decodedHash); + el?.scrollIntoView(); + }, 200); } });