/** * 跳轉至網頁頂端 * 當畫面往下滑 500 像素後會顯示此元件 * @param targetRef 關聯高度的目標 HTML 標籤 * @param showPercent 是否顯示百分比 * @returns {JSX.Element} * @constructor */ const JumpToTopButton = ({ showPercent = false, percent, className }) => { return (
{ window.scrollTo({ top: 0, behavior: 'smooth' }) }} />
) } export default JumpToTopButton