hexo 动画优化、支持图片卡牌配置

This commit is contained in:
tangly1024
2023-03-11 09:55:59 +08:00
parent d8ff172a82
commit 12a0367ddc
5 changed files with 14 additions and 14 deletions

View File

@@ -43,10 +43,10 @@ const Header = props => {
})
function updateHeaderHeight () {
setTimeout(() => {
requestAnimationFrame(() => {
const wrapperElement = document.getElementById('wrapper')
wrapperTop = wrapperElement?.offsetTop
}, 500)
})
}
return (
@@ -103,12 +103,12 @@ const scrollTrigger = () => {
) {
autoScroll = true
window.scrollTo({ top: wrapperTop, behavior: 'smooth' })
setTimeout(autoScrollEnd, 500)
requestAnimationFrame(autoScrollEnd)
}
if ((scrollS < windowTop) && (scrollS < window.innerHeight) && !autoScroll) {
autoScroll = true
window.scrollTo({ top: 0, behavior: 'smooth' })
setTimeout(autoScrollEnd, 500)
requestAnimationFrame(autoScrollEnd)
}
windowTop = scrollS
}