From eb618cc874a8ba6684d91875ec20a406f5a9117a Mon Sep 17 00:00:00 2001 From: Wick Date: Fri, 25 Jan 2019 11:59:23 +0100 Subject: [PATCH] refactor(app.js, glossary): make smoothscroll work with links in md --- app/dist/scripts/app.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/dist/scripts/app.js b/app/dist/scripts/app.js index 22117c0..6a50fa4 100755 --- a/app/dist/scripts/app.js +++ b/app/dist/scripts/app.js @@ -36,13 +36,8 @@ document.querySelectorAll("a[href^='#']").forEach(anchor => { if (document.getElementById(element)) { elementOffset = document.getElementById(element).offsetTop - 74; window.scroll({ top: elementOffset, behavior: "smooth" }); + history.replaceState({}, "", `#${element}`); // Add hash to URL bar } - - // Add hash to URL bar when sidebar links are clicked - if ( - event.target.parentElement.className === "api__toc__item" || - event.target.parentElement.parentElement.className === "component--glossary-toc" - ) history.replaceState({}, "", `#${element}`); }); });