스크롤 초기화: 페이지 전환 시 모바일 레이아웃 스크롤 컨테이너도 처리
This commit is contained in:
parent
381196820d
commit
e3667037c7
1 changed files with 7 additions and 0 deletions
|
|
@ -6,7 +6,14 @@ function ScrollToTop() {
|
|||
const { pathname } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
// window 스크롤 초기화
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
// 모바일 레이아웃 스크롤 컨테이너 초기화
|
||||
const mobileContent = document.querySelector('.mobile-content');
|
||||
if (mobileContent) {
|
||||
mobileContent.scrollTop = 0;
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue