Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make current page section detection resilient to sticky elements above header #664

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/furo/assets/scripts/furo.js
Expand Up @@ -140,8 +140,11 @@ function setupScrollSpy() {
recursive: true,
navClass: "scroll-current",
offset: () => {
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
return header.getBoundingClientRect().height + 0.5 * rem + 1;
const rem = parseFloat(
getComputedStyle(document.documentElement).fontSize,
);
const headerRect = header.getBoundingClientRect();
return headerRect.top + headerRect.height + 0.5 * rem + 1;
},
});
}
Expand Down