From 04c94837c246019a5c122dd8f11a3cf4f374f21c Mon Sep 17 00:00:00 2001 From: Json Choi <1890mah@gmail.com> Date: Thu, 22 Oct 2020 17:30:36 +0900 Subject: [PATCH] fix: scrollToHash get anchor by name --- grip/templates/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grip/templates/index.html b/grip/templates/index.html index 10970f0..de3902c 100644 --- a/grip/templates/index.html +++ b/grip/templates/index.html @@ -49,9 +49,9 @@ function scrollToHash() { if (location.hash && !document.querySelector(':target')) { - var element = document.getElementById('user-content-' + location.hash.slice(1)); - if (element) { - element.scrollIntoView(); + var elements = document.getElementsByName('user-content-' + location.hash.slice(1)); + if (elements.length) { + elements[0].scrollIntoView(); } } }