From: Tim Düsterhus Date: Fri, 25 Mar 2016 18:51:51 +0000 (+0100) Subject: Fix WoltLab/WCF/Dom/Util.offset X-Git-Tag: 3.0.0_Beta_1~1286^2~45 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=13d884839f750cc42a21c4b6c55dce5cf9229d0f;p=GitHub%2FWoltLab%2FWCF.git Fix WoltLab/WCF/Dom/Util.offset > The amount of scrolling that has been done of the viewport area (or > any other scrollable element) is taken into account when computing > the bounding rectangle. This means that the top and left property > change their values as soon as the scrolling position changes (so > their values are relative to the viewport and not absolute). If > this is not the desired behaviour just add the current scrolling > position to the top and left property (via window.scrollX and > window.scrollY) to get constant values independent from the current > scrolling position. see: https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Dom/Util.js b/wcfsetup/install/files/js/WoltLab/WCF/Dom/Util.js index 5d29a684dc..4e582ca990 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Dom/Util.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Dom/Util.js @@ -154,8 +154,8 @@ define(['Environment', 'StringUtil'], function(Environment, StringUtil) { var rect = el.getBoundingClientRect(); return { - top: rect.top + document.body.scrollTop, - left: rect.left + document.body.scrollLeft + top: rect.top + window.scrollY, + left: rect.left + window.scrollX }; },