jquery插件pagination实现无刷新ajax分页

jquery插件pagination实现无刷新ajax分页

1、前台使用ajax无刷新分页,主要需要生成分页的工具条,这里使用的是jquery.pagination.js

插件参数可以参考—-张龙豪-jquery.pagination.js分页

下面贴出代码

/**
* This jQuery plugin displays pagination links inside the selected elements.
*
* @author Gabriel Birke (birke *at* d-scribe *dot* de)
* @version .
* @param {int} maxentries Number of entries to paginate
* @param {Object} opts Several options (see README for documentation)
* @return {Object} jQuery Object
*/
jQuery.fn.pagination = function(maxentries, opts){
opts = jQuery.extend({
items_per_page:,
num_display_entries:,
current_page:,
num_edge_entries:,
link_to:”#”,
prev_text:”Prev”,
next_text:”Next”,
ellipse_text:”…”,
prev_show_always:true,
next_show_always:true,
callback:function(){return false;}
},opts||{});

return this.each(function() {
/**
* 计算最大分页显示数目
*/
function numPages() {
return Math.ceil(maxentries/opts.items_per_page);
}
/**
* 极端分页的起始和结束点,这取决于current_page 和 num_display_entries.
* @返回 {数组(Array)}
*/
function getInterval() {
var ne_half = Math.ceil(opts.num_display_entries/);
var np = numPages();
var upper_limit = np-opts.num_display_entries;
var start = current_page

© 版权声明

相关文章

暂无评论

none
暂无评论...