FIX: header offset position was not correct in some cases (#18155)
When a topic is opened in a new tab and is fully loaded the scroll
position is a bit off.
This commit partially reverts 9a55c9c433
.
This commit is contained in:
parent
754ad42344
commit
ce27dbd560
|
@ -177,6 +177,19 @@ const SiteHeaderComponent = MountWidget.extend(
|
|||
this.docAt = header.offsetTop;
|
||||
}
|
||||
|
||||
const headerRect = header.getBoundingClientRect();
|
||||
let headerOffsetCalc = headerRect.top + headerRect.height;
|
||||
|
||||
if (window.scrollY < 0) {
|
||||
headerOffsetCalc += window.scrollY;
|
||||
}
|
||||
|
||||
const newValue = `${headerOffsetCalc}px`;
|
||||
if (newValue !== this.currentHeaderOffsetValue) {
|
||||
this.currentHeaderOffsetValue = newValue;
|
||||
document.documentElement.style.setProperty("--header-offset", newValue);
|
||||
}
|
||||
|
||||
const main = document.querySelector(".ember-application");
|
||||
const offsetTop = main ? main.offsetTop : 0;
|
||||
const offset = window.pageYOffset - offsetTop;
|
||||
|
|
Loading…
Reference in New Issue