This feature has been deprecated. Use Element#scrollTo()
instead.
Load unpoly-migrate.js
to polyfill deprecated features.
Scrolls the given viewport to the given Y-position.
A "viewport" is an element that has scrollbars, e.g. <body>
or
a container with overflow-x: scroll
.
This will scroll a <div class="main">...</div>
to a Y-position of 100 pixels:
up.scroll('.main', 100)
The scrolling can (optionally) be animated.
up.scroll('.main', 100, { behavior: 'smooth' })
The absolute number of pixels to set the vertical scroll position to.
When set to 'instant'
, this will immediately scroll to the new position.
When set to 'smooth'
, this will scroll smoothly to the new position.