Smooth Scroll

Smooth Scroll

Conventional way

const hoge = hoge.getBoundingClientRect(); window.scrollTo({ left : hoge.left + window.pageXOffset, top: hoge.top + window.pageYOffset, behavior: 'smooth',
})
Enter fullscreen mode
Exit fullscreen mode

Recently way

hoge.scrollIntoView({behavior: "smooth"})
Enter fullscreen mode
Exit fullscreen mode

Viewport version

document.documentElement.clientHeight
Enter fullscreen mode
Exit fullscreen mode

Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *