Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: c776396528

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
img
js
README.md
index.html

README.md

Endless Scroll

If you don't already know, endless scroll (or infinite scrolling) is a popular technique among web 2.0 sites such as Google Reader and Live Image Search, where instead of paging through items using the traditional pagination technique, the page just keeps loading with new items attached to the end.

Configuration

There are a few options to customise the behaviour of this plugin:

Option Type Description
bottomPixels Integer The number of pixels from the bottom of the page that triggers the event.
fireOnce Boolean Only fire once until the execution of the current event is completed.
fireDelay Integer Delays the subsequent firing, in milliseconds, 0 or false to disable delay.
loader String The HTML to be displayed during loading.
data String or Function Plain HTML data, can be either a string or a function that returns a string, when passed as a function it accepts one argument: fire sequence (the number of times the event triggered during the current page session).
insertAfter String jQuery selector syntax: where to put the loader as well as the plain HTML data.
callback Function Callback function, accepts one argument: _fire sequence_ (the number of times the event triggered during the current page session).
resetCounter Function Resets the fire sequence counter if the function returns true, this function could also perform hook actions since it is applied at the start of the event.
ceaseFire Function Stops the event (no more endless scrolling) if the function returns true.

In a typical scenario, you won't be using the data option, but rather the callback option. You may use it to trigger an AJAX call and updates/inserts your page content.

Usage

// using default options
$(document).endlessScroll();
// using some custom options
$(document).endlessScroll({
  fireOnce: false,
  fireDelay: false,
  loader: "<div class="loading"><div>",
  callback: function(p){
    alert("test");
  }
});

Demo

Click here for a simple demo.

Changelog

v1.4.7 [2011-11-08]

  • Compatibility fix for IE7 and IE8.

v1.4.6 [2011-10-26]

  • Fixed an issue with inner_wrap and the first scroll event.

v1.4.5 [2011-09-25]

  • ceaseFire now works as expected during a scroll event.

v1.4.4 [2011-06-28]

  • The AJAX loader should be removed when there's no more results to load.

v1.4.3 [2011-06-28]

  • The data option now accepts a fireSequence argument too.

v1.4.2 [2011-01-08]

  • Fixed a bug where calling the script on $(document) would fail.

v1.4.1 [2010-06-18]

  • Fixed a bug where the callback fires when the inner wrap hasn't been created.

v1.4 [2010-06-18]

  • Endless Scroll now works with any elements, not just $(document)!

v1.3 [2009-04-20]

  • Fixed a bug caused by fireDelay.

v1.2 [2009-01-16]

  • Added resetCounter option.

v1.1 [2009-01-15]

  • Added fireDelay option.

v1.0 [2009-01-15]

  • Initial release.

License

Copyright (c) 2008 Fred Wu

Dual licensed under the MIT and GPL licenses.

Something went wrong with that request. Please try again.