Skip to content
A simple ampersand module to be used with any view in need of an infinite scroll element
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
ampersand-infinite-scroll.js
package.json

README.md

js-semistandard-style Dependency Status devDependency Status

ampersand-infinite-scroll

This module is still under development

A simple ampersand module to be used with any view in need of an infinite scroll element. This module assumes that the collection associated with the view implemments a method collection.fetchPage() as so it is a perfect match to be used with ampersand-pagination-mixin.

This module works by binding a function to the scroll event that fires a collection.fetchPage() request whenever the user reaches the bottom of the page.

Example:

  var View = require('ampersand-infinite-scroll');

  var Collection = require('./myCollection');

  var SpecialCollection = Collection.extend({
    fetchPage: function() {
      this.add([
        {message: "This"},
        {message: "Is"},
        {message: "Am"},
        {message: "Awesome"},
        {message: "View"},
        {message: "!"}
      ]);
    }
  });
  
  // Extend it like you wold normally do
  var MyView = View.extend({
    initialize: function () {
      console.log('My super awesome infinite scroll view');
    },
    collection: new SpecialCollection()
  });

  // And it's ready to be used
  var infiniteScrollView = new MyView();

credits

Created by @JGAntunes, with the support of @SINFO and based on a series of Ampersand Modules.

license

MIT

You can’t perform that action at this time.