aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--templates/partials/doc/toc_script.html14
1 files changed, 10 insertions, 4 deletions
diff --git a/templates/partials/doc/toc_script.html b/templates/partials/doc/toc_script.html
index 1453a69..7d10ee6 100644
--- a/templates/partials/doc/toc_script.html
+++ b/templates/partials/doc/toc_script.html
@@ -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() {
@@ -73,4 +79,4 @@ document.addEventListener("DOMContentLoaded", function() {
activeDocPage.parentElement.parentElement.previousElementSibling.previousElementSibling.checked = false;
});
-</script> \ No newline at end of file
+</script>