fix highlight on scroll

This commit is contained in:
Alex 2022-01-31 17:16:02 +01:00
parent d12c5941ed
commit 608c3f7759
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1

View file

@ -37,10 +37,16 @@ function isVisible(tocIndex) {
: document.querySelectorAll("section.section").item(1);
const c = current.getBoundingClientRect();
const n = next.getBoundingClientRect();
const h = (window.innerHeight || document.documentElement.clientHeight);
if (next) {
const n = next.getBoundingClientRect();
const h = (window.innerHeight || document.documentElement.clientHeight);
return (c.top <= h) && (n.top - menuBarHeight >= 0);
return (c.top <= h) && (n.top - menuBarHeight >= 0);
} else {
const h = (window.innerHeight || document.documentElement.clientHeight);
return (c.top <= h);
}
}
function activateIfVisible() {