移动端平滑滚动;
顶部菜单微调
This commit is contained in:
tangly1024
2021-12-16 13:13:29 +08:00
parent 71cc59f0d1
commit abea65474d
9 changed files with 40 additions and 87 deletions

View File

@@ -2,6 +2,8 @@ import React, { useEffect, useState } from 'react'
import { useGlobal } from '@/lib/global'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faArrowUp } from '@fortawesome/free-solid-svg-icons'
import smoothscroll from 'smoothscroll-polyfill'
let windowTop = 0
/**
@@ -32,6 +34,7 @@ const JumpToTopButton = ({ targetRef, showPercent = true }) => {
changePercent(per)
}
useEffect(() => {
smoothscroll.polyfill()
document.addEventListener('scroll', scrollListener)
return () => document.removeEventListener('scroll', scrollListener)
}, [show])