mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: include header offset relative to window (#11114)
This commit is contained in:
parent
fa12302e77
commit
3ee216c036
@ -7,7 +7,14 @@ export function minimumOffset() {
|
|||||||
iPadNav = document.querySelector(".footer-nav-ipad .footer-nav"),
|
iPadNav = document.querySelector(".footer-nav-ipad .footer-nav"),
|
||||||
iPadNavHeight = iPadNav ? iPadNav.offsetHeight : 0;
|
iPadNavHeight = iPadNav ? iPadNav.offsetHeight : 0;
|
||||||
|
|
||||||
return header ? header.offsetHeight + iPadNavHeight : 0;
|
// if the header has a positive offset from the top of the window, we need to include the offset
|
||||||
|
// this covers cases where a site has a custom header above d-header (covers fixed and unfixed)
|
||||||
|
const headerWrap = document.querySelector(".d-header-wrap"),
|
||||||
|
headerWrapOffset = headerWrap.getBoundingClientRect();
|
||||||
|
|
||||||
|
return header
|
||||||
|
? header.offsetHeight + headerWrapOffset.top + iPadNavHeight
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function offsetCalculator() {
|
export default function offsetCalculator() {
|
||||||
|
Loading…
Reference in New Issue
Block a user