X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tpl%2Fdefault%2Fjs%2Fshaarli.js;fp=tpl%2Fdefault%2Fjs%2Fshaarli.js;h=d8464aa4b86420731552763692e7dae908b53428;hb=e652ba3670a8481eaabb1f8bf721024107abd1e1;hp=2e533af6acbeebbf362e99ff021d6b352634528d;hpb=c03fd3f2bf90448b05405e5c08ba880c532f52ee;p=github%2Fshaarli%2FShaarli.git diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 2e533af6..d8464aa4 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -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; + } } };