The up.viewport
module controls the scroll position of 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>
.
When following a link to a fragment Unpoly will automatically scroll the document's viewport to reveal the updated content.
You should make Unpoly aware of fixed elements in your layout, such as navigation bars or headers. Unpoly will respect these sticky elements when revealing updated fragments.
You should also tell Unpoly when your application has more than one viewport, so Unpoly can pick the right viewport to scroll for each fragment update.
When using Bootstrap integration (unpoly-bootstrap3.js
and unpoly-bootstrap3.css
)
Unpoly will automatically be aware of sticky Bootstrap components such as
fixed navbar.
Marks this element as being anchored to the right edge of the screen, typically fixed navigation bars.
Marks this element as being fixed to the bottom edge of the screen
using position: fixed
.
Marks this element as being fixed to the top edge of the screen
using position: fixed
.
Marks this element as a scrolling container ("viewport").
Scroll's the given element's viewport so the first rows of the element are visible for the user.
Scrolls the given viewport to the given Y-position.
Returns the scrolling container for the given element.
Restores previously saved scroll positions of viewports
viewports configured in up.viewport.config.viewports
.
Reveals an element matching the given #hash
anchor.
Return the scrolling element for the browser's main content area.
Saves the top scroll positions of all the
viewports configured in up.viewport.config.viewports
.
Configures the application layout.