Description
This library is transplanted from react-tiny-virtual-list and react-virtualized.
Check out the demo for some examples.
angular-infinite-list alternatives and similar libraries
Based on the "Scroll" category.
Alternatively, view angular-infinite-list alternatives based on common mentions on social networks and blogs.
-
fullPage
fullPage plugin by Alvaro Trigo. Create full screen pages fast and simple -
skrollr
Stand-alone parallax scrolling library for mobile (Android + iOS) and desktop. No jQuery. -
iscroll
iScroll is a high performance, small footprint, dependency free, multi-platform javascript scroller. -
parallax
Parallax Engine that reacts to the orientation of a smart device -
ScrollMagic
The javascript library for magical scroll interactions. -
onepage-scroll
Create an Apple-like one page scroller website (iPhone 5S website) with One Page Scroll plugin -
headroom
Give your pages some headroom. Hide your header until you need it -
vue-virtual-scroller
⚡️ Blazing fast scrolling for any amount of data -
locomotive-scroll
🛤 Detection of elements in viewport & smooth scrolling with parallax. -
Clusterize.js
Tiny vanilla JS plugin to display large data sets easily -
elevator.js
Finally, a "back to top" button that behaves like a real elevator. -
scrollMonitor
A simple and fast API to monitor elements as you scroll -
jparallax
jQuery plugin for creating interactive parallax effect -
simpleParallax
Simple and tiny JavaScript library that adds parallax animations on any images -
ScrollMenu
A new interface to replace your old boring scrollbar -
MiniBar
A lightweight scrollbar library written in vanilla javascript. -
Trig.js
The easy way to create CSS scroll animations that react to the position of your HTML element on screen. Animate on scroll (AOS) your CSS.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of angular-infinite-list or a related project?
README
A short and powerful infinite scroll list library for angular, with zero dependencies 💪
- Tiny & dependency free – Only 3kb gzipped
- Render millions of items, without breaking a sweat
- Scroll to index or set the initial scroll offset
- Supports fixed or variable heights/widths
- Vertical or Horizontal lists
This library is transplanted from react-tiny-virtual-list and react-virtualized.
Check out the demo for some examples.
Getting Started
Using npm:
npm install angular-infinite-list --save
Import angular Infinite list module into your app module
import { InfiniteListModule } from 'angular-infinite-list';
@NgModule({
imports: [
BrowserModule,
FormsModule,
InfiniteListModule,
...
Wrap Infinite list tag around list items
<infinitelist
style="width:100%"
[width]='"100%"'
[height]='500'
[data]='data'
[itemSize]='50'
(update)='event = $event'>
<div *ngFor="let item of event?.items; let i=index;" [ngStyle]="event.getStyle(i)">
item{{event.start + i}} : {{item|json}}
</div>
</infinitelist>
or directive usage
<div infinitelist [width]='"100%"' ...</div>
Higher performance usage
Because in the angular all the asynchronous operation will cause change detection.High-frequency operations such as the scroll event can cause significant performance losses.
So in some high-precision scenes, we can use rxjs Observable to solve. About angular asynchronous, change detection checks and zone.js. You can view zone.js and change detection
set @Input [useob]='true'
and use ChangeDetectorRef
You can switch to the Observable mode. of course, if your scene on the efficiency requirements are not high can not do so.
demo.component.html
<infinitelist
[width]='"100%"'
[height]='500'
[data]='data'
[itemSize]='150'
[useob]='true'
(update)='update($event)'>
<div class="li-con" *ngFor="let item of event?.items; let i=index;" [ngStyle]="event.getStyle(i)">
item{{event.start + i}}
</div>
</infinitelist>
demo.component.ts
Notice! useob mode update trigger once and otherwise it will trigger multiple times
event: ILEvent;
constructor(private cdRef: ChangeDetectorRef) { }
//Notice! useob mode update trigger once and otherwise it will trigger multiple times
update($event: Subject<any>) {
$event.subscribe(x => {
this.event = x;
this.cdRef.detectChanges();
});
}
Prop Types
Property | Type | Required? | Description |
---|---|---|---|
width | Number or String* | ✓ | Width of List. This property will determine the number of rendered items when scrollDirection is 'horizontal' . |
height | Number or String* | ✓ | Height of List. This property will determine the number of rendered items when scrollDirection is 'vertical' . |
data | any[] | ✓ | The data that builds the templates within the Infinite scroll. |
itemSize | ✓ | Either a fixed height/width (depending on the scrollDirection), an array containing the heights of all the items in your list, or a function that returns the height of an item given its index: (index: number): number |
|
scrollDirection | String | Whether the list should scroll vertically or horizontally. One of 'vertical' (default) or 'horizontal' . |
|
scrollOffset | Number | Can be used to control the scroll offset; Also useful for setting an initial scroll offset | |
scrollToIndex | Number | Item index to scroll to (by forcefully scrolling if necessary) | |
scrollToAlignment | String | Used in combination with scrollToIndex , this prop controls the alignment of the scrolled to item. One of: 'start' , 'center' , 'end' or 'auto' . Use 'start' to always align items to the top of the container and 'end' to align them bottom. Use 'center ' to align them in the middle of the container. 'auto' scrolls the least amount possible to ensure that the specified scrollToIndex item is fully visible. |
|
overscanCount | Number | Number of extra buffer items to render above/below the visible items. Tweaking this can help reduce scroll flickering on certain browsers/devices. | |
estimatedItemSize | Number | Used to estimate the total size of the list before all of its items have actually been measured. The estimated total height is progressively adjusted as items are rendered. | |
update | Output | This event is fired every time when dom scroll. The event sent by the parameter is a ILEvent object. |
* Width may only be a string when scrollDirection
is 'vertical'
. Similarly, Height may only be a string if scrollDirection
is 'horizontal'
The IILEvent interface
export interface IILEvent {
items: any[],
offset: number,
getStyle(index: number): any,
data?: any[],
start?: number,
stop?: number
}
Reporting Issues
Found an issue? Please report it along with any relevant details to reproduce it.
Acknowledgments
This library is transplanted from react-tiny-virtual-list and react-virtualized. Thanks for the great works of author Claudéric Demers ❤️
License
is available under the MIT License.
*Note that all licence references and agreements mentioned in the angular-infinite-list README section above
are relevant to that project's source code only.