优化跳转到评论逻辑

This commit is contained in:
tlyong1992
2022-05-31 17:04:59 +08:00
parent 976e519058
commit c7788abed5
7 changed files with 39 additions and 25 deletions

View File

@@ -36,11 +36,11 @@ const WalineComponent = (props) => {
const type = mutation.type
if (type === 'childList') {
const anchorElement = document.getElementById(anchor.substring(1))
if (anchorElement) {
if (anchorElement && anchorElement.className === 'wl-item') {
anchorElement.scrollIntoView({ block: 'end', behavior: 'smooth' })
setTimeout(() => {
anchorElement.classList.add('animate__animated')
anchorElement.classList.add('animate__bounceIn')
anchorElement.classList.add('animate__bounceInRight')
observer.disconnect()
}, 300)
}