fix: 解决首页报错offsetWidth undefined
This commit is contained in:
@@ -4,8 +4,7 @@ import { ScrollTrigger } from 'gsap/ScrollTrigger'
|
||||
import './index.less'
|
||||
import SvgIcon from '@/components/SvgIcon/SvgIcon.tsx'
|
||||
const HomeIndex: React.FC = () => {
|
||||
useEffect(() => {
|
||||
document.body.classList.add('body')
|
||||
const animationFunction=()=>{
|
||||
if (!CSS.supports('animation-timeline: scroll()')) {
|
||||
// const SPAN = 'max(45vw, 260px)';
|
||||
const CONFIG = [
|
||||
@@ -189,8 +188,13 @@ const HomeIndex: React.FC = () => {
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
useEffect(() => {
|
||||
document.body.classList.add('body')
|
||||
window.addEventListener('resize', animationFunction);
|
||||
return () => {
|
||||
document.body.classList.remove('body')
|
||||
window.removeEventListener('resize', animationFunction);
|
||||
}
|
||||
}, [])
|
||||
return (
|
||||
|
Reference in New Issue
Block a user