From 9fba5d42a139d526d2df1d5366db22ca456735dd Mon Sep 17 00:00:00 2001 From: happhee Date: Fri, 18 Oct 2024 23:51:26 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EC=9D=B8=EC=9B=B9=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EC=B5=9C=EC=83=81=EB=8B=A8=EC=9C=BC=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/common/LayoutWrapper.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/common/LayoutWrapper.tsx b/components/common/LayoutWrapper.tsx index e6b2266..bf38e41 100644 --- a/components/common/LayoutWrapper.tsx +++ b/components/common/LayoutWrapper.tsx @@ -15,15 +15,20 @@ function LayoutWrapper({ children }: LayoutWrapperProps) { const contentRef = useRef(null); const scrollEventRef = useRef(false); - //@Note 페이지 이동 시에도 항상 스크롤 맨 위 고정 - useEffect(() => { + const moveToScrollTop = () => { smoothscroll.polyfill(); if (!outerRef.current) return; + outerRef.current.scrollIntoView({ behavior: 'auto', block: 'start', inline: 'nearest', }); + }; + + //@Note 페이지 이동 시에도 항상 스크롤 맨 위 고정 + useEffect(() => { + moveToScrollTop(); }, [asPath]); // 랜딩페이지 IntroSection Scroll 이벤트 @@ -31,7 +36,7 @@ function LayoutWrapper({ children }: LayoutWrapperProps) { if (asPath === PATH.Home) { const outerRefCurrent = outerRef.current; if (!outerRefCurrent) return; - + moveToScrollTop(); const wheelAnimationHandler = (e: WheelEvent) => { e.preventDefault();