Pagination for js filters when there are more than 10 pages - not view more button
/* in filters.js find this bit
if(this.container_paging){
if(page_count>1){
$('.pagination').show();
} else{
$('.pagination').hide();
}
}
and replace it with the code below
*/
if(this.container_paging){
if(page_count>1){
if($('.pagination .page').length > 9){
$('.pagination .page').hide();
$('.pagination .sep').remove();
var curr = $('.pagination .page.current').index();
var plength = $('.pagination .page').length;
if(curr == 0){
$('.pagination .page').each(function(index){
if (index < 4 || index > plength-4){
$(this).show();
}
if(index == curr+3){
$(this).append('<span class="sep"> ... </span>');
}
});
}else if(curr+1 == plength){
$('.pagination .page').each(function(index){
if (index < 3 || index > plength-5){
$(this).show();
}
if(index == curr-3){
$(this).prepend('<span class="sep"> ... </span>');
}
});
}else{
$('.pagination .page').each(function(index){
if (index == 0 || index == plength-1 || index == curr){
$(this).show();
}else if(index < curr + 3 && index > curr -3){
$(this).show();
}
if(index == curr-2 && index != 0){
$(this).prepend('<span class="sep"> ... </span>');
}
if(index == curr+2 && index != plength-1){
$(this).append('<span class="sep"> ... </span>');
}
});
}
}
$('.pagination').show();
} else{
$('.pagination').hide();
}
}