patrickkunka / mixitup

A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more
https://www.kunkalabs.com/mixitup/
4.52k stars 734 forks source link

Scroll position is at the bottom of the list after clicking on a pagination control #589

Closed ajplopez closed 2 years ago

ajplopez commented 2 years ago

I'm using MixItUp with the pagination plugin.

I have a list of 20 items. There are 9 items per page. So the first page has 9, the second page has 9, and the last page has 2 items. If on the first or second page (with 9 items each), the user has to scroll down to see the pagination controls.

Once I scroll down, when I click on the 3rd pager item, it shows the last 2 items but the scroll position is still at the bottom of the list.

Is there a way I can make it scroll back to the top of the listing after clicking on the pager controls? Because in cases like this where the third page is shorter than the rest, the user has to scroll back up to see the results.

ajplopez commented 2 years ago

Realized that I can use the onMixStart method to scroll back up: https://www.kunkalabs.com/mixitup/docs/configuration-object/