Edit this page

API Scrolling
module up.viewport

The up.viewport module controls the scroll position and focus within scrollable containers ("viewports").

The default viewport for any web application is the main document. An application may define additional viewports by giving the CSS property { overflow-y: scroll } to any <div>.

Also see documentation for the scroll option and focus option.

Topics

Essential features

All features

HTML
[up-anchored=right] stable

Marks this element as being anchored to the right edge of the screen, typically fixed navigation bars.

HTML
[up-fixed=bottom] stable

Marks this element as being fixed to the bottom edge of the screen using position: fixed.

HTML
[up-fixed=top] stable

Marks this element as being fixed to the top edge of the screen using position: fixed.

JS
up.focus(element, ) experimental

Focuses the given element.

JS
up.reveal(element, [options]) stable

Scrolls the given element's viewport so the first rows of the element are visible for the user.

HTML
[up-viewport] stable

Marks this element as a scrolling container ("viewport").

JS
up.viewport.closest(target) deprecated

Returns the scrolling container for the given element.

JS
up.viewport.config stable

Configures defaults for scrolling.

JS
up.viewport.get(target) experimental

Returns the scrolling container for the given element.

JS
up.viewport.restoreScroll([viewport], [options]) experimental

Restores previously saved scroll positions of viewports viewports configured in up.viewport.config.viewportSelectors.

JS
up.viewport.root() experimental

Return the scrolling element for the browser's main content area.

JS
up.viewport.saveScroll([options]) experimental

Saves the top scroll positions of all viewports in the current layer.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more