加入新的打赏码;

文章详情页重新排班;
文章卡牌动画调整;
This commit is contained in:
tangly1024
2021-11-05 13:20:02 +08:00
parent ded8f27c2a
commit 15fb499f44
14 changed files with 68 additions and 58 deletions

View File

@@ -14,7 +14,7 @@ const JumpToTop = ({ targetRef, showPercent = true }) => {
const { locale } = useGlobal()
const [show, switchShow] = useState(false)
const [percent, changePercent] = useState(0)
const scrollListener = useCallback(throttle(() => {
const scrollListener = () => {
// 处理是否显示回到顶部按钮
const clientHeight = targetRef ? (targetRef.current ? targetRef.current.clientHeight : 0) : 0
const scrollY = window.pageYOffset
@@ -26,7 +26,7 @@ const JumpToTop = ({ targetRef, showPercent = true }) => {
let per = parseFloat(((scrollY / fullHeight * 100)).toFixed(0))
if (per > 100) per = 100
changePercent(per)
}, 100))
}
useEffect(() => {
document.addEventListener('scroll', scrollListener)
return () => document.removeEventListener('scroll', scrollListener)