Affix
Pins slotted content to the viewport once its scroll position passes a threshold (sticky-on-scroll).
Preview
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
offset-top | number | — | px gap from the top of the viewport when affixed |
offset-bottom | number | — | px gap from the bottom of the viewport when affixed |
Installation
pura is copy-paste and dependency-free. Load the whole library, or just this component.
<link rel="stylesheet" href="/pura/tokens.css">
<script type="module" src="/pura/lib/affix.js"></script> import "./pura/lib/affix.js";