-
-
Notifications
You must be signed in to change notification settings - Fork 98
Integration
Murhaf Sousli edited this page Jul 19, 2019
·
27 revisions
The scrollViewport
directive allows you to set use custom viewport element in your template.
<ng-scrollbar>
<div scrollViewport class="custom-viewport">
<div class="content-wrapper">
<!-- content -->
</div>
</div>
</ng-scrollbar>
NOTE:
scrollViewport
directive must be used on the direct child of<ng-scrollbar>
NOTE: When using
scrollViewport
directive on an element, It is recommended that the viewport element has one and only once child element that acts as a content wrapper (like.content-wrapper
in the above example), this content wrapper is needed if you are using theResizeSensor
which observes content changes and updates the UI accordingly.
Integrate with CDK VirtualScroll.
<ng-scrollbar>
<cdk-virtual-scroll-viewport itemSize="50" scrollViewPort>
<div *cdkVirtualFor="let item of items">{{item}}</div>
</cdk-virtual-scroll-viewport>
</ng-scrollbar>
Integrate with ngx-infinite-scroll.
<ng-scrollbar>
<div infiniteScroll [scrollWindow]="false" scrollViewport>
<mat-list>
<mat-list-item class="example-item" *ngFor="let i of array">
{{ i }}
</mat-list-item>
</mat-list>
</div>
</ng-scrollbar>
Become a sponsor and get your logo on our README on GitHub and the front page of https://ngx-scrollbar.netlify.com/.
Become a backer and get your logo on our README on GitHub.
Latest version (v15)
Addons:
Older version (v13)
- Demo for v13
- Usage
- Styling
- Global Options
- Pointer Events
- Scroll Event
- Updated Event
- Smooth Scroll Functions
- Performance tweak
- Integration
- Reached events