From f1550e01d6d7e634860484c2916475e236c3d78e Mon Sep 17 00:00:00 2001 From: Matthew Kousoulas Date: Thu, 3 Mar 2022 15:25:01 -0500 Subject: [PATCH] Smooth scroll on load --- scripts/dom.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/dom.js b/scripts/dom.js index 40fba08..edaf1d9 100644 --- a/scripts/dom.js +++ b/scripts/dom.js @@ -115,14 +115,19 @@ var DOM = (dom => { CLASS.show(dom.logo); setTimeout(() => { CLASS.show(dom.thumb_layer); - dom.scrollTo(window.location.hash); + if (window.location.hash) { + setTimeout(() => { + dom.scrollTo(window.location.hash); + }, 300); + } }, 300); }, 500); } dom.scrollTo = (hash) => { if (hash) { - document.getElementById(hash.substring(1)).scrollIntoView(); + document.getElementById(hash.substring(1)) + .scrollIntoView({behavior: "smooth"}); } } -- 2.45.3