scrollto js code example
Example 1: javascript scroll to top of page
//Instant scroll to top of page
window.scrollTo(0, 0);
Example 2: javascript scroll to element
document.getElementById("divId").scrollIntoView();
Example 3: js scrollto
element.scrollTo(x, y);
window.scrollTo(x, y);
element.scrollTo({
top: 100,
left: 100,
behavior: 'smooth'
});
Example 4: scroll js
window.scroll(x-coord, y-coord)
window.scroll(options)