more robust toc scroll
This commit is contained in:
+4
-1
@@ -216,7 +216,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
|
||||
var rect = article.getBoundingClientRect();
|
||||
var total = Math.max(article.scrollHeight - 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),
|
||||
|
||||
Reference in New Issue
Block a user