knockout-contrib

:metal: KnockoutJS Goodies Monorepo

View the Project on GitHub Profiscience/knockout-contrib

bindings.infiniteScroll

Version Dependency Status Peer Dependency Status Dev Dependency Status Downloads

This package is intended for consumption via the @profiscience/knockout-contrib metapackage

Call a function when the end of an element is reached

Usage

<div data-bind="foreach: todos, infiniteScroll: fetchMoreTodos">...</div>

with a custom offset

By default the infinite scroll will trigger 1500px before reaching the bottom of the bound element. This can be customized, for example to preload slower APIs sooner you could define a larger offset.

<div
  data-bind="foreach: todos, infiniteScroll: { handler: fetchMoreTodos, offset: 2000 }"
>
  ...
</div>