Angular ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly.
Setup
Refer to PrimeNG setup documentation for download and installation steps for your environment.
Import
import {ScrollTopModule} from 'primeng/scrolltop';
Getting Started
Without any configuration, ScrollTop listens window scroll.
<p-scrollTop></p-scrollTop>
Threshold
When the vertical scroll position reaches a certain value, ScrollTop gets displayed. This value is defined with the threshold property that defaults to 400.
<p-scrollTop [threshold]="200"></p-scrollTop>
Target Element
ScrollTop can also be assigned to its parent element by setting target as "parent".
<div style="height: 400px; overflow: auto">
Content that overflows to container
<p-scrollTop target="parent"></p-scrollTop>
</div>
Theming
ScrollTop supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.
Resources
Visit the PrimeNG ScrollTop showcase for demos and documentation.