fix highlight on scroll
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d12c5941ed
commit
608c3f7759
1 changed files with 10 additions and 4 deletions
|
@ -37,10 +37,16 @@ function isVisible(tocIndex) {
|
||||||
: document.querySelectorAll("section.section").item(1);
|
: document.querySelectorAll("section.section").item(1);
|
||||||
|
|
||||||
const c = current.getBoundingClientRect();
|
const c = current.getBoundingClientRect();
|
||||||
const n = next.getBoundingClientRect();
|
if (next) {
|
||||||
const h = (window.innerHeight || document.documentElement.clientHeight);
|
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() {
|
function activateIfVisible() {
|
||||||
|
@ -73,4 +79,4 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
activeDocPage.parentElement.parentElement.previousElementSibling.previousElementSibling.checked = false;
|
activeDocPage.parentElement.parentElement.previousElementSibling.previousElementSibling.checked = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue