jquery分頁外掛程式

2022-01-19 17:28:25 字數 2816 閱讀 8731

css**:

/*

分頁*/

.pagelist .pagelist a,

.pagelist span .pagelist a:hover,

.pagelist_current .pagelist .pagelist_hidden .pagelist .pagelist_hidden:hover .pagelist input.jumpnum .pagelist a.jumptext .pagelist a.jumptext:hover

js外掛程式**

(function

($) };

//重置html

function

resethtml(opts,obj,pagecount)

else

if(type==2)

return "" + page + "";}};

var html="首頁

"; html+="上頁";

if(pagecount<=opts.num)

}else

}else

}html += getpagehtml(1);

for(i=pagecount-2;i<=pagecount;i++)

}else

html += getpagehtml(1);

//debugger

z=opts.page-1;//

當前頁的前一頁,省略號的後一格

maxpage=z+n-1;

//maxpage=maxpage>pagecount?pagecount:maxpage;

if(maxpage>pagecount)

for(i=z;i<=maxpage;i++)}}

html+="下頁";

html+="末頁";

html+="";

html+="跳轉";

obj.html(html);

//return html;

} $.fn.pagelist=function

(opts),defaults,opts);

this.each(function

() opts.page=page;

opts.clickevent(page,

function

());

});//首頁

obj.on("click",".pagelist_firstpage",function

() opts.page=1;

opts.clickevent(page,

function

());

});//上頁

obj.on("click",".pagelist_prevpage",function

() opts.page=page;

opts.clickevent(page,

function

());

});// obj.on("click",".pagelist_nextpage",function

() opts.page=page;

opts.clickevent(page,

function

());

});//末頁

obj.on("click",".pagelist_lastpage",function

() opts.page=pagecount;

opts.clickevent(page,

function

());

});//文字框enter

obj.on("keyup",".jumpnum",function

(e)

var textpage=$(this

).val();

if(isnan(textpage))

textpage=parseint(textpage);

var page=parseint($(".pagelist_current",obj).html());

if(textpage>pagecount||textpage<=0)

if(page==textpage)

opts.page=textpage;

opts.clickevent(page,

function

());

});//單擊跳轉

obj.on("click",".jumptext",function

(e) textpage=parseint(textpage);

var page=parseint($(".pagelist_current",obj).html());

if(textpage>pagecount||textpage<=0)

if(page==textpage)

opts.page=textpage;

opts.clickevent(page,

function

());

});});

}})(jquery);

外掛程式呼叫:

$(function

() });

});

最終效果:

jquery外掛程式 ajax分頁

突然發現,好久沒寫部落格了,越來越懶了.今天想說說ajax分頁的事,其實ajax分頁莫過於解決兩個問題,第一,總條數的獲取,第二,形成分頁 like this 總條數的獲取莫過於兩種方式,第一,載入時直接獲取,可通過變數設定,可通過url傳值,第二種通過ajax請求的資料中包含資料和總條數。資料的獲...

jQuery分頁外掛程式twbsPagination

需求說明 這裡主要介紹jquery的分頁外掛程式twbspagination。當然了還有其他的分頁外掛程式,感覺上這個外掛程式還是比較簡單易用的。步驟一 建立page.jsp頁面,引用jquery.twbspagination.js,page.js script src basepath js jq...

jQuery 分頁外掛程式 jqPaginator

例子 用法很簡單,首先引入jquery和jqpaginator,之後就可以初始化分頁了 id jqpaginator onpagechange function num 上例就是第一demo,bootstrap風格的分頁。具體引數稍後介紹,這裡要了解的是,如果使用的不是id,而是class,就會初始...