Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
  • Loading branch information
zkz098 committed Sep 21, 2024
2 parents 9f7a4a3 + 45e4269 commit 0e6fadb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/js/_app/components/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const sidebarTOC = () => {
while (!parent.matches('.contents')) {
if (parent.matches('li')) {
parent.addClass('active')
const t = document.querySelector(decodeURIComponent(parent.querySelector('a.toc-link').getAttribute('href')))
const t = document.getElementById(decodeURIComponent(parent.querySelector('a.toc-link').getAttribute('href').replace('#', '')))
if (t) {
t.addClass('active')
}
Expand All @@ -147,13 +147,13 @@ export const sidebarTOC = () => {

sections = sections.map((element, index) => {
const link = element.querySelector('a.toc-link')
const anchor = document.querySelector(decodeURI(link.getAttribute('href')))
const anchor = document.getElementById(decodeURI(link.getAttribute('href').replace('#', '')))
if (!anchor) return null
const alink = anchor.querySelector('a.anchor')

const anchorScroll = (event:MouseEvent) => {
event.preventDefault()
const target = document.querySelector(decodeURI((event.currentTarget as HTMLElement).getAttribute('href')))
const target = document.getElementById(decodeURI((event.currentTarget as HTMLElement).getAttribute('href').replace('#', '')))

activeLock = index
pageScroll((target as HTMLElement), null, () => {
Expand Down

0 comments on commit 0e6fadb

Please sign in to comment.