mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed some scroll issues
This commit is contained in:
parent
58676ac1d5
commit
677dce9721
3 changed files with 25 additions and 10 deletions
|
@ -36,6 +36,8 @@ const FlowLayoutUnconnected: FC<IProps> = ({
|
|||
flowLoadMoreSearch,
|
||||
}) => {
|
||||
const onLoadMore = useCallback(() => {
|
||||
(window as any).flowScrollPos = window.scrollY;
|
||||
|
||||
const pos = window.scrollY + window.innerHeight - document.body.scrollHeight;
|
||||
|
||||
if (is_loading || pos < -600) return;
|
||||
|
@ -54,6 +56,10 @@ const FlowLayoutUnconnected: FC<IProps> = ({
|
|||
return () => window.removeEventListener('scroll', onLoadMore);
|
||||
}, [onLoadMore]);
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, (window as any).flowScrollPos || 0);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.grid}>
|
||||
<div className={styles.hero}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue