From: Alexander Ebert Date: Wed, 29 Jan 2020 21:49:08 +0000 (+0100) Subject: Include the overlaying page header in position calculations X-Git-Tag: 5.2.2~26^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=077111c6c1ba4fd31500747b11c8196c3d0d8585;p=GitHub%2FWoltLab%2FWCF.git Include the overlaying page header in position calculations --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js index e3d2c6beed..d34d50144a 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js @@ -233,11 +233,23 @@ define(['Core', 'Language', 'Dom/Traverse', 'Dom/Util'], function(Core, Language var bottom = 'auto'; var top = 'auto'; var result = true; + + var pageHeaderOffset = 50; + var pageHeaderPanel = elById('pageHeaderPanel'); + if (pageHeaderPanel !== null) { + var position = window.getComputedStyle(pageHeaderPanel).position; + if (position === 'fixed' || position === 'static') { + pageHeaderOffset = pageHeaderPanel.offsetHeight; + } + else { + pageHeaderOffset = 0; + } + } if (align === 'top') { var bodyHeight = document.body.clientHeight; bottom = (bodyHeight - refOffsets.top) + verticalOffset; - if (bodyHeight - (bottom + elDimensions.height) < (window.scrollY || window.pageYOffset)) { + if (bodyHeight - (bottom + elDimensions.height) < (window.scrollY || window.pageYOffset) + pageHeaderOffset) { result = false; } }