Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b3b48d2936

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

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.

I have developed a jQuery plugin to easily achieve this.

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

  • 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) - delay the subsequent firing, in milliseconds, 0 or false to disable delay
  • loader (string) - the HTML to be displayed during loading
  • data (string|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.


// using default options
// using some custom options
  fireOnce: false,
  fireDelay: false,
  loader: "<div class="loading"><div>",
  callback: function(p){


Click here for a simple demo.


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.


Copyright (c) 2008 Fred Wu

Dual licensed under the MIT and GPL licenses.

Something went wrong with that request. Please try again.