Jquery ajax paginate not picking up elements

Ah, ok.
Something like this?

@James_Hibbard Awesome - It makes more sense when I see the code

.show is the variable that needs changed…

Just to be complete, here’s the code I used (in case my example should disappear at a later date):

$(function(){
  $('.container div:gt(1)').hide();
				
  $('.pagination').jqPagination({
    max_page : $('.container div').length/2,
    paged : function(page) {
      $('.container div').hide();
      $($('.container div')[page*2-1]).show();
      $($('.container div')[page*2-2]).show();
    }
  });
});

Pullo -SORRY LAST REQUEST if I have an odd number of divs say 5 or 7 and want to show 2 at a time except for the last one can I change the


      $($('.container div')[page*2-1]).show();
      $($('.container div')[page*2-2]).show();

to allow this?

In this case, you’ll want to round up the number of pages to allow for this possibility.

This:

max_page : $('.container div').length/2,

should become:

max_page : Math.ceil($('.container div').length/2),

Demo.

Right okay so

Math.ceil
does a simple round up - very good to know - that’s it (Mods please close before Pullo shoots me!)

To be really exact, it returns the smallest integer greater than or equal to the number number it receives as a parameter.
You can read more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil

Right, off to get me gun now … :slight_smile: