ampersand-infinite-scroll.js
function InfiniteScrollSetup (options) {
  options || (options = {});
  var self = this;
  var gap = (options.gap || 20); // defaults to 20

  self.events = self.events || {};
  assign(self.events, {scroll: 'infiniteScroll'});

  self.infiniteScroll = function () {
    if (this.el.scrollHeight - this.el.scrollTop <= this.el.clientHeight + gap) {
      this.collection.fetchPage(options);
    }
  };
}
function InfiniteScrollSetup (options) {
  options || (options = {});
  var self = this;
  var gap = (options.gap || 20); // defaults to 20

  self.events = self.events || {};
  assign(self.events, {scroll: 'infiniteScroll'});

  self.infiniteScroll = function () {
    if (this.el.scrollHeight - this.el.scrollTop <= this.el.clientHeight + gap) {
      this.collection.fetchPage(options);
    }
  };
}
function InfiniteScrollSetup ( options ) { options || ( options = { } ) ; var self = this ; var gap = ( options . gap || 20 ) ; // defaults to 20 self . events = self . events || { } ; assign ( self . events , { scroll : 'infiniteScroll' } ) ; self . infiniteScroll = function ( ) { if ( this . el . scrollHeight - this . el . scrollTop <= this . el . clientHeight + gap ) { this . collection . fetchPage ( options ) ; } } ; }
Setup the closure function for the Infinite Scroll callback

@param {Object}  options - the valid options are:
.gap - the pixel margin to fire the request
Setup the closure function for the Infinite Scroll callback