From: Matthew Kousoulas Date: Thu, 3 Mar 2022 20:25:01 +0000 (-0500) Subject: Smooth scroll on load X-Git-Url: http://gitweb.madkous.net/?a=commitdiff_plain;h=f1550e01d6d7e634860484c2916475e236c3d78e;p=photo-site.git Smooth scroll on load --- 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"}); } }