Skip to content

Commit

Permalink
fix : 인웹에서 최상단으로 이동되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Happhee committed Oct 18, 2024
1 parent 4803943 commit 9fba5d4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/common/LayoutWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,28 @@ function LayoutWrapper({ children }: LayoutWrapperProps) {
const contentRef = useRef<any>(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 이벤트
useEffect(() => {
if (asPath === PATH.Home) {
const outerRefCurrent = outerRef.current;
if (!outerRefCurrent) return;

moveToScrollTop();
const wheelAnimationHandler = (e: WheelEvent) => {
e.preventDefault();

Expand Down

0 comments on commit 9fba5d4

Please sign in to comment.