more robust toc scroll

This commit is contained in:
2026-04-30 00:14:19 +02:00
parent 3bcf9f47fb
commit 84b2b85bf6
2 changed files with 8 additions and 2 deletions
@@ -216,7 +216,10 @@ document.addEventListener('DOMContentLoaded', function () {
}
var rect = article.getBoundingClientRect();
var total = Math.max(article.offsetHeight - window.innerHeight, 1);
var total = Math.max(
Math.max(article.scrollHeight, article.offsetHeight) - window.innerHeight,
1
);
var progress = Math.min(
Math.max((-rect.top / total) * 100, 0),