Yofinity ![Build Status](https://travis-ci.org/crewstyle/yofinity.svg)
an infinite scroll jQuery plugin
![GitHub version](https://badge.fury.io/gh/crewstyle%2Fyofinity.svg)
Package manager
bower install --save yohoho.yofinity
npm install yohoho.yofinity
Install
<a href="http://example.com/page/2" title="Next posts" rel="next">Loading...</a>
$('body').yofinity({
buffer: 1000,
navSelector: 'a[rel="next"]',
success: function ($link, response){
$link.before(response);
$link.attr('href', '/page/2');
},
error: function ($link){
$link.remove();
}
});
Settings
Option | Type | Default | Description |
---|
buffer | integer | 1000 | Number of pixels to fire infinite scroll BEFORE the node element |
context | object | window | - |
debug | boolean | false | Enables the debug tools when it's needed |
error | function | null | Function called if script fires an error |
loading | function | null | Function called when script fires loading |
navSelector | string | 'a[rel="next"]' | Define node element containing AJAX request through the href attribute |
success | function | null | Function called when script fires success |
Dependencies
jQuery 2.1.4
Authors and Copyright
Made with ♥ by Achraf Chouk
Please, read LICENSE for more details.