Browse Source

adjust pagination display slider

master
JoBCB 4 years ago
parent
commit
3a9c117c2d
  1. 20
      templates/browsethearchive.html

20
templates/browsethearchive.html

@ -47,14 +47,15 @@
<script type="text/javascript"> <script type="text/javascript">
//Pagination https://www.javaer101.com/en/article/123201810.html //Pagination https://www.javaer101.com/en/article/123201810.html
pageSize = 4; pageSize = 24;
incremSlide = 5; incremSlide = 5;
startPage = 0; startPage = 0;
numberPage = 0; numberPage = 0;
var pageCount = $(".browsethearchive-items").length / pageSize; var pageCount = $(".browsethearchive-items").length / pageSize;
var totalSlidepPage = Math.floor(pageCount / incremSlide); var totalSlidepPage = Math.floor(pageCount / incremSlide);
for(var i = 0 ; i<pageCount;i++){ for(var i = 0 ; i<pageCount;i++){
$("#pagin").append('<li><a href="#">'+(i+1)+'</a></li> '); $("#pagin").append('<li><a href="#">'+(i+1)+'</a></li> ');
if(i>pageSize){ if(i>pageSize){
@ -98,11 +99,11 @@ slide = function(sens){
}else{ }else{
next.show(); next.show();
prev.show(); prev.show();
} }
} }
slide();
showPage = function(page) { showPage = function(page) {
$(".browsethearchive-items").hide(); $(".browsethearchive-items").hide();
$(".browsethearchive-items").each(function(n) { $(".browsethearchive-items").each(function(n) {
@ -121,11 +122,11 @@ var activeLink;
$("#pagin li a").click(function() { $("#pagin li a").click(function() {
$listItems.removeClass('current'); $listItems.removeClass('current');
$(this).addClass('current'); $(this).addClass('current');
var activeLink=$(this); var activeLink=$(this);
showPage(parseInt($(this).text())); showPage(parseInt($(this).text()));
}); });
@ -142,6 +143,7 @@ $(".prev").click(function() {
showPage(--i); showPage(--i);
} }
}); });
$(".next").click(function() { $(".next").click(function() {
let nextLi = $("#pagin li a.current").parent().next().find("a"); let nextLi = $("#pagin li a.current").parent().next().find("a");

Loading…
Cancel
Save