Const
Scrolls the viewport to a specific x,y coordinate position.
Uses the browser's window.scrollTo API with configurable behavior.
window.scrollTo
Operation data with scroll properties erased
// Smooth scroll to positionconst result = scrollToPosition({ x: 0, y: 500, behavior: 'smooth'}); Copy
// Smooth scroll to positionconst result = scrollToPosition({ x: 0, y: 500, behavior: 'smooth'});
// Instant scroll to topconst result = scrollToPosition({ x: 0, y: 0}); Copy
// Instant scroll to topconst result = scrollToPosition({ x: 0, y: 0});
Scrolls the viewport to a specific x,y coordinate position.
Uses the browser's
window.scrollToAPI with configurable behavior.