]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tpl/default/js/shaarli.js
Keep up with master changes
[github/shaarli/Shaarli.git] / tpl / default / js / shaarli.js
index 2e533af6acbeebbf362e99ff021d6b352634528d..d8464aa4b86420731552763692e7dae908b53428 100644 (file)
@@ -216,11 +216,13 @@ window.onload = function () {
     /**
      * Remove CSS target padding (for fixed bar)
      */
-    var anchor = document.querySelector(location.hash);
-    if (anchor != null) {
-        var padsize = anchor.clientHeight;
-        console.log(document.querySelector(location.hash).clientHeight);
-        this.window.scroll(0, this.window.scrollY - padsize);
-        anchor.style.paddingTop = 0;
+    if (location.hash != '') {
+        var anchor = document.querySelector(location.hash);
+        if (anchor != null) {
+            var padsize = anchor.clientHeight;
+            console.log(document.querySelector(location.hash).clientHeight);
+            this.window.scroll(0, this.window.scrollY - padsize);
+            anchor.style.paddingTop = 0;
+        }
     }
 };