Paging with Jquery

1

I searched some websites and here in the stack looking for how to create a paging script with the following characteristics:

  • Elements are collected at HTML
  • I can use the function at any time and in any element, just invoking it and passing the parameters (such as number of elements per page, which element should be paged, what the paging element is, etc.) li>

In the case, I did not find any question / answer that could completely clarify these points, I also did not find a good API , I tried easyPaginate , however it is generating errors in jquery when being used. Any suggestion of API or script for this paging?

    <div id="pagination">
        <div>
            <figure></figure>
            <figure></figure>
            <figure></figure>
            <figure></figure>
            <figure></figure>
            <figure></figure>
            <figure></figure>
        </div>
    </div>

A script that can be used in a simple way, like the easyPaginate itself that I mentioned above

$("#pagination").paginar({
   elemento:figure,
   elementosporpagina:3
});
    
asked by anonymous 04.10.2017 / 21:34

1 answer

1

Use the elements this way

<div id="pagination">
            <figure><img src="https://fakeimg.pl/50/"></figure><figure><imgsrc="https://fakeimg.pl/50/"></figure><figure><imgsrc="https://fakeimg.pl/50/"></figure><figure><imgsrc="https://fakeimg.pl/50/"></figure><figure><imgsrc="https://fakeimg.pl/50/"></figure><figure><imgsrc="https://fakeimg.pl/50/"></figure><figure><imgsrc="https://fakeimg.pl/50/"></figure></div>

Jquery.paginate

After linking the library (js and css), add

$('#pagination').paginate({ 'perPage': 5 });
$('#pagination').paginate({ 'scope': $('figure') });
    
04.10.2017 / 22:29