Why not just use the (popular) nginfinitescroll directive? nginfinitescroll is awesome, simple, and lightweight, but when working with mobile devices especially, it's good practice to limit the number of DOM elements on the screen so we wanted something that would limit the DOM to only the visible elements. This directive address that and has some more robust features. If you don't need these extra features and/or want ALL content to remain visible on the DOM as you scroll, by all means stick with something like nginfinitescroll - it gets the job done and is more lightweight (less code) than this. But if you want a bit more control and DOM performance, try this out.
http://jackrabbitsgroup.github.io/angular-infinitescroll/
- required:
- AngularJS >=1.2.2
- jQuery (tested with 1.8.3) - NOTE: we're aiming to remove this dependency to keep it more lightweight
See bower.json
and index.html
in the gh-pages
branch for a full list / more details
- download the files
- Bower
- add
"angular-infinitescroll": "latest"
to yourbower.json
file then runbower install
OR runbower install angular-infinitescroll
- add
- Bower
- include the files in your app
infinitescroll.min.js
infinitescroll.less
ORinfinitescroll.min.css
ORinfinitescroll.css
- include the module in angular (i.e. in
app.js
) -jackrabbitsgroup.angular-infinitescroll
See the gh-pages
branch, files bower.json
and index.html
for a full example.
See the infinitescroll.js
file top comments for usage examples and documentation
https://github.com/jackrabbitsgroup/angular-infinitescroll/blob/master/infinitescroll.js