]> MadKous Network Git Server - photo-site.git/commitdiff
Smooth scroll on load
authorMatthew Kousoulas <shaman.kous@gmail.com>
Thu, 3 Mar 2022 20:25:01 +0000 (15:25 -0500)
committerMatthew Kousoulas <shaman.kous@gmail.com>
Thu, 3 Mar 2022 20:25:01 +0000 (15:25 -0500)
scripts/dom.js

index 40fba08e0009307aca4f4feefe075698b82ce8cf..edaf1d93e8d724916410fbbb0f8e6817ce9afb47 100644 (file)
@@ -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"});
                }
        }