Answers for "pagination always show 5 pages"

PHP
0

pagination always show 5 pages

function pageRange(page,pageCount){

var start = page-2,
    end = page+2;

if(end>pageCount){
    start-=(end-pageCount);
    end=pageCount;
}
if(start<=0){
    end+=((start-1)*(-1));
    start=1;
}

end = end>pageCount?pageCount:end;

return {start:start, end:end};
}
Posted by: Guest on November-09-2020

Browse Popular Code Answers by Language