FMgr.Site/Content/pagination/jquery.pagination.min.js
(完整代码) 2KB/**
* pagination分页插件
* @version 0.1
* @url http://www.maxiaoxiang.com
* @E-mail 251445460@qq.com
*/
;(function($,window,document,undefined){var defaults={totalData:0,showData:0,pageCount:9,current:1,prevCls:'prev',nextCls:'next',prevContent:'<',nextContent:'>',activeCls:'active',coping:false,homePage:'',endPage:'',count:3,callback:function(){}};var Pagination=function(element,options){var opts=options,current,$obj=$(element);this.getTotalPage=function(){return opts.totalData&&opts.showData?Math.ceil(parseInt(opts.totalData)/opts.showData):opts.pageCount};this.getCurrent=function(){return current};this.filling=function(index){var html='';current=index||opts.current;var pageCount=this.getTotalPage();if(current>1){html+='<a href="javascript:;" class="'+opts.prevCls+'">'+opts.prevContent+'</a>'}else{$obj.find('.'+opts.prevCls)&&$obj.find('.'+opts.prevCls).remove()}if(current>=opts.count*2&¤t!=1&&pageCount!=opts.count){var home=opts.coping&&opts.homePage?opts.homePage:'1';html+=opts.coping?'<a href="javascript:;" data-page="1">'+home+'</a><span>...</span>':''}var start=current-opts.count,end=current+opts.count;((start>1&¤t<opts.count)||current==1)&&end++;(current>pageCount-opts.count&¤t>=pageCount)&&start++;for(;start<=end;start++){if(start<=pageCount&&start>=1){if(start!=current){html+='<a href="javascript:;" data-page="'+start+'">'+start+'</a>'}else{html+='<span class="'+opts.activeCls+'">'+start+'</span>'}}}if(current+opts.count<pageCount&¤t>=1&&pageCount>opts.count){var end=opts.coping&&opts.endPage?opts.endPage:pageCount;html+=opts.coping?'<span>...</span><a href="javascript:;" data-page="'+pageCount+'">'+end+'</a>':''}if(current<pageCount){html+='<a href="javascript:;" class="'+opts.nextCls+'">'+opts.nextContent+'</a>'}else{$obj.find('.'+opts.nextCls)&&$obj.find('.'+opts.nextCls).remove()}$obj.empty().html(html)};this.eventBind=function(){var self=this;$obj.on('click','a',function(){if($(this).hasClass(opts.nextCls)){var index=parseInt($obj.find('.'+opts.activeCls).text())+1}else if($(this).hasClass(opts.prevCls)){var index=parseInt($obj.find('.'+opts.activeCls).text())-1}else{var index=parseInt($(this).data('page'))}self.filling(index);typeof opts.callback==='function'&&opts.callback(index)})};this.init=function(){this.filling(opts.current);this.eventBind()};this.init()};$.fn.pagination=function(parameter,callback){if(typeof parameter=='function'){callback=parameter;parameter={}}else{parameter=parameter||{};callback=callback||function(){}}var options=$.extend({},defaults,parameter);return this.each(function(){var pagination=new Pagination(this,options);callback(pagination)})};return $})(jQuery,window,document);
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
