페이지 내 특정 위치(좌표값)로 이동시켜준다.
window.scrollTo({left: x좌표, top: y좌표})
현재 위치를 기준으로 스크롤을 이동시킨다.
window.scrollBy({left: x좌표, top: y좌표})
페이지 내 특정 요소로 스크롤을 이동시킨다.
const box = document.querySelector('.box');
box.scrollIntoView()
스크롤을 부드럽게 움직이고 싶다면
window.scrollTo({left:0, top:0, behavior:'smooth'})