扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
小编给大家分享一下jquery.pager.js实现分页效果的示例,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
创新互联长期为超过千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为弋阳企业提供专业的成都做网站、成都网站设计,弋阳网站改版等技术服务。拥有10年丰富建站经验和众多成功案例,为您定制开发。
具体内容如下
1.html
{{maxPage}}{{title}}{{page}}
2.Pager.css
#pager ul.pages{ display:block; border:none; text-transform:uppercase; font-size:10px;margin:10px 0 50px;padding:0; } #pager ul.pages li{ list-style:none; float:left; border:1px solid #ccc; text-decoration:none; margin:-20px 5px 0 0;padding:5px; } #pager ul.pages li:hover{border:1px solid #003f7e; } #pager ul.pages li.pgEmpty{ border:1px solid #eee; color:#eee; } #pager ul.pages li.pgCurrent{ border:1px solid #3c90d9; color: #fff; font-weight:700; /*background-color:#eee;*/ background: #3c90d9 none repeat scroll 0 0; } #pager{margin-left: 290px;}
3.jquery.pager.js
/* * jQuery pager plugin * Version 1.0 (12/22/2008) * @requires jQuery v1.2.6 or later * * Example at: http://jonpauldavies.github.com/JQuery/Pager/PagerDemo.html * * Copyright (c) 2008-2009 Jon Paul Davies * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Read the related blog post and contact the author at http://www.j-dee.com/2008/12/22/jquery-pager-plugin/ * * This version is far from perfect and doesn't manage it's own state, therefore contributions are more than welcome! * * Usage: .pager({ pagenumber: 1, pagecount: 15, buttonClickCallback: PagerClickTest }); * * Where pagenumber is the visible page number * pagecount is the total number of pages to display * buttonClickCallback is the method to fire when a pager button is clicked. * * buttonClickCallback signiture is PagerClickTest = function(pageclickednumber) * Where pageclickednumber is the number of the page clicked in the control. * * The included Pager.CSS file is a dependancy but can obviously tweaked to your wishes * Tested in IE6 IE7 Firefox & Safari. Any browser strangeness, please report. */ (function($) { $.fn.pager = function(options) { var opts = $.extend({}, $.fn.pager.defaults, options); return this.each(function() { // empty out the destination element and then render out the pager with the supplied options $(this).empty().append(renderpager(parseInt(options.pagenumber), parseInt(options.pagecount), options.buttonClickCallback)); // specify correct cursor activity $('.pages li').mouseover(function() { document.body.style.cursor = "pointer"; }).mouseout(function() { document.body.style.cursor = "auto"; }); }); }; // render and return the pager with the supplied options function renderpager(pagenumber, pagecount, buttonClickCallback) { // setup $pager to hold render var $pager = $('
看完了这篇文章,相信你对“jquery.pager.js实现分页效果的示例”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流