superRaytin / paginationjs

A jQuery plugin to provide simple yet fully customisable pagination.
http://pagination.js.org
MIT License
912 stars 659 forks source link

Go top after click on page #93

Closed Lowell130 closed 5 years ago

Lowell130 commented 5 years ago

Hello after click on the page button, how i can move to top page?

superRaytin commented 5 years ago

If you want to move to the first page, you can just call container.pagination('go', 8) or container.pagination(8)

ref: http://pagination.js.org/docs/index.html#go

danielbenjamins commented 4 years ago

I think @Lowell130 meant he wants to get automatically scrolled to the top of the container. So when you click on 2, 3, etc. you start seeing the first results of the new page instead of it keeps you hanging at the bottom of the container (where the pagination is).

npujar commented 4 years ago
afterRender: function() {
    $('html').animate({
          scrollTop: ($("body").offset().top)
     }, 150);
}

@Lowell130 @eaglejohn : I used the afterRender method to manually trigger scroll to top