From 13d884839f750cc42a21c4b6c55dce5cf9229d0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 25 Mar 2016 19:51:51 +0100 Subject: [PATCH] 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 --- wcfsetup/install/files/js/WoltLab/WCF/Dom/Util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 }; }, -- 2.20.1