Nach oben scrollen 1.2.0
Füge <velin-scroll-top> einmal pro Seite hinzu. Es erscheint nach überschreiten eines Scroll-Schwellenwerts und scrollt sanft nach oben (respektiert prefers-reduced-motion). English: Nach oben scrollen
Reifegrad: Dokumentiert als stabil in VelinStyle 1.2.0. Design Intelligence (Plan / Review / Agent-Meta) ist separat und Beta / Foundation wo vermerkt.
Wann verwenden
- Ein schwebendes Control, um auf langen Seiten per
<velin-scroll-top>oder deklarativem Attribut nach oben zurückzukehren. - Docs, Artikel oder Dashboards mit großer Scrolltiefe.
Wann nicht
- In-section navigation — use Scrollspy oder ein Inhaltsverzeichnis.
- Required reading acknowledgements — do not rely on scroll-top as a completion control.
Deklaratives Attribut
Ohne Custom Element im Markup setze velin-scroll-top on <body> (oder ein beliebiges Element). Erfordert bootFromDOM(document, { attributes: true }) or bootAttributes():
<body velin-scroll-top="400">
...
</body>
Siehe HTML-Attribute-Guide.
Basis
Scrolle diese Seite, um den Button in der unteren Ecke zu sehen.
<velin-scroll-top threshold="300"></velin-scroll-top>
Attribute
| Attribut | Standard | Hinweise |
|---|---|---|
threshold | 300 | Scroll-Offset (px), bevor der Button angezeigt wird |
Styling
Positionierung über CSS-Variablen auf :host:
velin-scroll-top {
--velin-scroll-top-bottom: 1.5rem;
--velin-scroll-top-end: 1.5rem;
}
Barrierefreiheit
- Fixes
aria-label="Scroll to top"auf dem Control. - Nutzt
scroll-behaviornur wenn Reduced Motion deaktiviert ist.