Skip to content

Commit c0ebc4a

Browse files
committed
feat(js): adjustScroll use closest parent instead of the first summary
1 parent c6fcaba commit c0ebc4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/static/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ document.addEventListener("DOMContentLoaded", function () {
126126
let target = document.querySelector(hash)
127127
if (target) {
128128
let offsetSearch = document.querySelector("#search_text").offsetHeight
129-
let offsetCategory = document.querySelector("summary.category_name").offsetHeight
129+
let offsetCategory = target.closest("summary").offsetHeight
130130
window.scrollTo({
131131
top: target.offsetTop - offsetSearch - offsetCategory - 1,
132132
behavior: "smooth"

0 commit comments

Comments
 (0)