Skip to content
JQuery plugin for ajax-enabled infinite page scroll
JavaScript
Branch: master
Clone or download
serggl Merge pull request #1 from webjunkie/patch-1
Remove jQuery wrapper so it may be faster
Latest commit 0ca8f86 Oct 23, 2013
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Remove jQuery wrapper so it may be faster Oct 22, 2013
.gitignore initial commit Aug 26, 2013
README.md update README Aug 26, 2013
infiniteScroll.jquery.json initial commit Aug 26, 2013

README.md

jQuery Infinite Scroll Plugin

JQuery plugin for ajax-enabled infinite page scroll. There are a lot of jQuery plugins for infinite page scrolling function. However none of them matched my needs when I faced the problem. So this is a very simple plugin which makes ajax call to load more data on the page and gives some basic callbacks like data loading started or data did loaded.

##Usage sample

CoffeScript:

$ ->
	$('#tasks').infiniteScroll
		itemSelector: 'tr.task'
		dataPath: '/tasks/load_more_tasks'

HTML part:

<table id='tasks'>
	<thead>
		<th>ID</th>
		<th>Name</th>
	</thead>
	<tbody>
		<tr class='task'>
			<td>1</td>
			<td>First</td>
		</tr>
		<tr class='task'>
			<td>2</td>
			<td>Second</td>
		</tr>
		...more rows
	</tbody>
</table>

AJAX part: /tasks/load_more_tasks. This should return plain HTML:

<tr class='task'>
	<td>10</td>
	<td>Tenth</td>
</tr>
<tr class='task'>
	<td>21</td>
	<td>Eleventh</td>
</tr>
...even more rows

Options

dataPath - URL to load more data from

itemSelector - single item selector for data items initially loaded and loaded via AJAX

onDataLoading - callback function. Called when more data items should be loaded. Has single parameter supplied - page number

onDataLoaded - callback function. Called when additional data items were loaded. Has single parameter supplied - page number

onDataError - callback function. Called when there was an error loading data trough AJAX. Has single parameter supplied - page number

You can’t perform that action at this time.