Add auto scroll (still has problem)

This commit is contained in:
2023-09-11 18:32:49 +08:00
parent 201d6485e9
commit be12a7a753
2 changed files with 64 additions and 62 deletions

View File

@@ -35,28 +35,15 @@ const MainFramework: React.FC = () => {
const hideScrollbarRef = useRef<HideScrollbarElement>(null)
const [navbarHidden, setNavbarHidden] = useState(true)
const [preventScroll, setPreventScroll] = useState(false)
const [preventScroll, setPreventScroll] = useState(true)
useEffect(() => {
setNavbarHidden(false)
}, [pathname])
const handleOnWheel = useCallback((event: React.WheelEvent) => {
console.log(event)
}, [])
const handleOnScroll = useCallback((event: React.UIEvent) => {
console.log(event)
}, [])
return (
<>
<HideScrollbar
ref={hideScrollbarRef}
onWheel={handleOnWheel}
onScroll={handleOnScroll}
isPreventScroll={preventScroll}
>
<HideScrollbar ref={hideScrollbarRef} isPreventScroll={preventScroll}>
<div className={'body'}>
<header className={'nav' + (navbarHidden ? ' hide' : '')}>
<a className={'logo'} href={'https://fatweb.top'}>