mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: prevent scroll errors
This commit is contained in:
parent
83815ea051
commit
995421642d
1 changed files with 7 additions and 4 deletions
|
|
@ -58,10 +58,13 @@ function scrollToRepoContent() {
|
|||
function scrollToNodeElement(index) {
|
||||
const nodeElementSelector = '.node-item'
|
||||
const nodeElements = document.querySelectorAll(nodeElementSelector)
|
||||
nodeElements[index].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
})
|
||||
const targetElement = nodeElements[index]
|
||||
if (targetElement) {
|
||||
targetElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const pjax = new PJAX({
|
||||
|
|
|
|||
Loading…
Reference in a new issue