fixed scrollspy

This commit is contained in:
sergeych committed 2025-12-22 06:30:40 +01:00
1 parent 0add0ab54c
commit 0dbfb473bf
3 files changed
+11 -7

No files matched your search

+1 -1
View File
@@ -181,7 +181,7 @@ fun DocsPage(
scheduled = false
try {
val heads = toc.mapNotNull { id -> el.querySelector("#${id.id}") as? HTMLHeadingElement }
val tops = heads.map { it.getBoundingClientRect().top + window.scrollY }
val tops = heads.map { it.getBoundingClientRect().top }
val offset = (updateNavbarOffsetVar() + 16).toDouble()
val idx = activeIndexForTops(tops, offset)
setActiveTocId(if (idx in toc.indices) toc[idx].id else null)