스크롤 초기화: 페이지 전환 시 모바일 레이아웃 스크롤 컨테이너도 처리

This commit is contained in:
caadiq 2026-01-12 16:01:50 +09:00
parent 381196820d
commit e3667037c7

View file

@ -6,7 +6,14 @@ function ScrollToTop() {
const { pathname } = useLocation(); const { pathname } = useLocation();
useEffect(() => { useEffect(() => {
// window
window.scrollTo(0, 0); window.scrollTo(0, 0);
//
const mobileContent = document.querySelector('.mobile-content');
if (mobileContent) {
mobileContent.scrollTop = 0;
}
}, [pathname]); }, [pathname]);
return null; return null;