mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-16 23:41:21 +08:00
fix: add toc slug judge
This commit is contained in:
@ -35,9 +35,11 @@ const {
|
|||||||
link.addEventListener('click', (event) => {
|
link.addEventListener('click', (event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const slug = link.getAttribute('data-slug')
|
const slug = link.getAttribute('data-slug')
|
||||||
const element = document.getElementById(slug)
|
if (slug) {
|
||||||
if (element) {
|
const element = document.getElementById(slug)
|
||||||
element.scrollIntoView({ behavior: 'smooth' })
|
if (element) {
|
||||||
|
element.scrollIntoView({ behavior: 'smooth' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user