fix: 🐛
This commit is contained in:
parent
d756d8fc2f
commit
dd1fd83045
1 changed files with 5 additions and 3 deletions
|
|
@ -30,12 +30,14 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
const scrollTop = scrollAreaRef.current?.scrollTop || 0
|
const scrollTop = scrollAreaRef.current?.scrollTop || 0
|
||||||
if (scrollTop > lastScrollTop) {
|
const diff = scrollTop - lastScrollTop
|
||||||
|
if (diff > 20) {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
} else {
|
|
||||||
setVisible(true)
|
|
||||||
}
|
|
||||||
setLastScrollTop(scrollTop)
|
setLastScrollTop(scrollTop)
|
||||||
|
} else if (diff < -20) {
|
||||||
|
setVisible(true)
|
||||||
|
setLastScrollTop(scrollTop)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollArea = scrollAreaRef.current
|
const scrollArea = scrollAreaRef.current
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue