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