i want limit simple jquery pagination
now ---> 1 2 3 4 5 6 7 8 9 10
i whant convert ----> < 1 2 3... >
after click on 3 ---> < 2 3 4... >
i use imtech_pager pagination
<!--in imtech_pager.js --> var imtech = {}; imtech.pager = function() { this.paragraphsperpage = 3; this.currentpage = 1; this.pagingcontrolscontainer = '#pagingcontrols'; this.pagingcontainerpath = '#content'; this.numpages = function() { var numpages = 0; if (this.paragraphs != null && this.paragraphsperpage != null) { numpages = math.ceil(this.paragraphs.length / this.paragraphsperpage); } return numpages; }; this.showpage = function(page) { this.currentpage = page; var html = ''; this.paragraphs.slice((page-1) * this.paragraphsperpage, ((page-1)*this.paragraphsperpage) + this.paragraphsperpage).each(function() { html += '<div>' + $(this).html() + '</div>'; }); $(this.pagingcontainerpath).html(html); rendercontrols(this.pagingcontrolscontainer, this.currentpage, this.numpages()); } var rendercontrols = function(container, currentpage, numpages) { var pagingcontrols = 'page: <ul style="margin-left: -10px;">'; (var = 1; <= numpages; i++) { if (i != currentpage) { pagingcontrols += '<li><a href="#" onclick="pager.showpage(' + + '); return false;">' + + '</a></li>'; } else { pagingcontrols += '<li>' + + '</li>'; } } pagingcontrols += '</ul>'; $(container).html(pagingcontrols); } } <!--for pagination --> var pager = new imtech.pager(); $(document).ready(function() { pager.paragraphsperpage =12; // set amount elements per page pager.pagingcontainer = $('#content'); // set of main container pager.paragraphs = $('div.z', pager.pagingcontainer); // set of required containers pager.showpage(1); }); <!-- jump script --> $(document).ready(function() { $(".jumper").on("click", function( e ) { e.preventdefault(); $("body, html").animate({ scrolltop: $( $(this).attr('href') ).offset().top }, 600); }); });
<div class="example"> <div id="content"> <div class="z">one</div> <div class="z">tow</div> . . . <div class="z">three</div> </div> </div> <div id="pagingcontrols"></div>
i whant convert < 1 2 3 ... >
after click on 3 --> < 2 3 4... >
please me
thanks
Comments
Post a Comment