Submit your widget

jQuery plugin to provide simple yet fully customisable pagination

Created about a year ago   Views 4567   downloads 947    Author superRaytin
 jQuery plugin to provide simple yet fully customisable pagination
View DemoDownload 461.0 KB
14
Share |

A jQuery plugin to provide simple yet fully customisable pagination.

Quick Start

 

HTML:

<div id="data-container"></div>
<div id="pagination-container"></div>

JS:

$('#pagination-container').pagination({
    dataSource: [1, 2, 3, 4, 5, 6, 7, ... , 195],
    callback: function(data, pagination) {
        // template method of yourself
        var html = template(data);
        $('#data-container').html(html);
    }
})

Below is a minimal rendering method:

function simpleTemplating(data) {
    var html = '<ul>';
    $.each(data, function(index, item){
        html += '<li>'+ item +'</li>';
    });
    html += '</ul>';
    return html;
}

Call:

$('#pagination-container').pagination({
    dataSource: [1, 2, 3, 4, 5, 6, 7, ... , 195],
    callback: function(data, pagination) {
        var html = simpleTemplating(data);
        $('#data-container').html(html);
    }
})

Read more:https://github.com/superRaytin/paginationjs

Tag: pagination