From dffc8ef9400fcf47198eb03109246838d9d835ad Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 12 Dec 2015 22:48:45 +0200 Subject: [PATCH] Optimise auto-scroll for docs by hash --- docs/_templates/footer.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/_templates/footer.html b/docs/_templates/footer.html index 02cb30a6..5b562649 100644 --- a/docs/_templates/footer.html +++ b/docs/_templates/footer.html @@ -34,10 +34,11 @@ if ($('#pionav').css('display') !== 'block') { return; } - window.setTimeout('$(window).scrollTop($(window).scrollTop() - 50);', 50); - $(window).on('hashchange', function(e){ + function fixScroll() { $(window).scrollTop($(window).scrollTop() - 50); - }); + } + window.setTimeout(fixScroll, 50); + $(window).on('hashchange', function(e){fixScroll();}); }); };