In this post, I’m going to show you how to create a scroll to top function in JavaScript. Scroll to top is a simple user-friendly feature. That lets the user return back to the top of the website with just one click.
HTML
<button onclick="scrollToTop()">Scroll To Top</button>
JavaScript
function scrollToTop(){
window.scrollTo({
top:0,
behavior:'smooth'
})
}
Keywords: javascript scroll to top, scroll to top javascript, scroll to top js.
Pingback: 10 Websites to boost your Frontend skills - Sajan Kc