Skip to content

Commit

Permalink
fix(theme): remove extra offset
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Jan 16, 2024
1 parent 0ce5ece commit 3f6ca6a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/client/theme-default/composables/outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,6 @@ export function useActiveAnchor(
return
}

// pixel offset, start of main content
const offsetDocTop = (() => {
const container =
document.querySelector('#VPContent .VPDoc')?.firstElementChild
if (container) return getAbsoluteTop(container as HTMLElement)
else return 78
})()

const scrollY = window.scrollY
const innerHeight = window.innerHeight
const offsetHeight = document.body.offsetHeight
Expand Down Expand Up @@ -180,7 +172,7 @@ export function useActiveAnchor(
// find the last header above the top of viewport
let activeLink: string | null = null
for (const { link, top } of headers) {
if (top > scrollY + offsetDocTop + getScrollOffset()) {
if (top > scrollY + getScrollOffset() + 4) {
break
}
activeLink = link
Expand Down

0 comments on commit 3f6ca6a

Please sign in to comment.