Skip to content

Commit 03c8880

Browse files
Make current page section detection resilient to sticky elements above header (#664)
1 parent ff34139 commit 03c8880

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/furo/assets/scripts/furo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ function setupScrollSpy() {
141141
navClass: "scroll-current",
142142
offset: () => {
143143
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
144-
return header.getBoundingClientRect().height + 2.5 * rem + 1;
144+
const headerRect = header.getBoundingClientRect();
145+
return headerRect.top + headerRect.height + 2.5 * rem + 1;
145146
},
146147
});
147148
}

0 commit comments

Comments
 (0)