mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
FIX: calculate docking - include offset of main (#16079)
Include a calculation of offset in main - this allows docking to be calculated (again) using global offsets, in case there is a custom header outside of Discourse that pushes forum content down.
This commit is contained in:
parent
7f9c0e476f
commit
91cbd28fa4
@ -196,7 +196,10 @@ const SiteHeaderComponent = MountWidget.extend(
|
||||
document.documentElement.style.setProperty("--header-offset", newValue);
|
||||
}
|
||||
|
||||
if (window.pageYOffset >= this.docAt) {
|
||||
const main = document.querySelector("#main");
|
||||
const offsetTop = main ? main.offsetTop : 0;
|
||||
const offset = window.pageYOffset - offsetTop;
|
||||
if (offset >= this.docAt) {
|
||||
if (!this.dockedHeader) {
|
||||
document.body.classList.add("docked");
|
||||
this.dockedHeader = true;
|
||||
|
Loading…
Reference in New Issue
Block a user