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