From: Alexander Ebert Date: Mon, 13 May 2013 17:49:14 +0000 (+0200) Subject: Improved initial jump to an anchor X-Git-Tag: 2.0.0_Beta_1~200 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=37c05ff02399a8f8ec23a16de6c4d456968276b3;p=GitHub%2FWoltLab%2FWCF.git Improved initial jump to an anchor --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 852ff9bea7..5285678ded 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -5508,13 +5508,23 @@ WCF.System.JumpToAnchor = { if (window.location.hash) { var $element = $(window.location.hash); if ($element.length) { - $element.addClass('userPanelJumpToAnchorFix'); - - new WCF.PeriodicalExecuter(function(pe) { - pe.stop(); + if ($.browser.chrome || $.browser.msie) { + $element.addClass('userPanelJumpToAnchorFix'); - $element.removeClass('userPanelJumpToAnchorFix'); - }, 5000); + $(document).on('readystatechange', function() { + if (document.readyState === 'complete') { + // wait 100ms + new WCF.PeriodicalExecuter(function(pe) { + pe.stop(); + + $element.removeClass('userPanelJumpToAnchorFix'); + }, 100); + } + }); + } + else { + window.scrollBy(0, -1 * $('.userPanel').outerHeight()); + } } } }