Add mouse and keyboard control scroll. Add auto homing when window resize. #19
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
import FitFullScreen from '@/components/common/FitFullScreen'
|
||||
import FitCenter from '@/components/common/FitCenter'
|
||||
import { MainFrameworkContext } from '@/pages/MainFramework'
|
||||
@@ -24,6 +24,14 @@ const Home: React.FC = () => {
|
||||
})
|
||||
}, [setNavbarHidden, setPreventScroll])
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const handleWindowResize = () => {
|
||||
handleScrollToContent(currentContent)()
|
||||
}
|
||||
window.addEventListener('resize', handleWindowResize)
|
||||
return () => window.removeEventListener('resize', handleWindowResize)
|
||||
})
|
||||
|
||||
const handleScrollToContent = (index: number) => {
|
||||
return () => {
|
||||
if (!index) {
|
||||
|
||||
Reference in New Issue
Block a user