Yofinity, an infinite scroll jQuery plugin

‹ Github project page

Getting started

Article 1

Vivamus id nulla orci. Integer scelerisque ut lacus a ultrices. Praesent sit amet aliquet purus, varius tempus augue. Aliquam nec diam lacinia, porta enim eget, venenatis purus.

Article 2

Vivamus id nulla orci. Integer scelerisque ut lacus a ultrices. Praesent sit amet aliquet purus, varius tempus augue. Aliquam nec diam lacinia, porta enim eget, venenatis purus.

Article 3

Vivamus id nulla orci. Integer scelerisque ut lacus a ultrices. Praesent sit amet aliquet purus, varius tempus augue. Aliquam nec diam lacinia, porta enim eget, venenatis purus.

Article 4

Vivamus id nulla orci. Integer scelerisque ut lacus a ultrices. Praesent sit amet aliquet purus, varius tempus augue. Aliquam nec diam lacinia, porta enim eget, venenatis purus.

Article 5

Vivamus id nulla orci. Integer scelerisque ut lacus a ultrices. Praesent sit amet aliquet purus, varius tempus augue. Aliquam nec diam lacinia, porta enim eget, venenatis purus.


<a href="./yofinity.html?page=1" title="Next posts" rel="next">Loading...</a>
            

(function ($){
    var _number = 2;

    $('body').yofinity({
        buffer: 1000,
        navSelector: 'a[rel="next"]',
        success: function ($link, response){
            $link.before(response);
            $link.attr('href', './yofinity.html?page=' + _number);
            _number++;
        },
        error: function ($link){
            $link.remove();
        }
    });
})(jQuery);
            

Options

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