Pagination: Scroll to top and update URL

I noticed strange behavior in L&L pagination in archive as next page is loaded in ajax but there is a problem when clicked on next page the content gets updated but page doesn’t bring user to the top (first post) but it remains on the last post even after loading however user waits for page to load or go to top.

Hi Zakir,
Could you clarify the issue you’re having? The pagination is loading the next page of posts correctly but not scrolling to the top of the Loop?

If that’s the issue you’re having, that’s actually the expected behaviour for Ajax pagination.

I don’t think scrolling should be the default behaviour, but we might consider adding an option to scroll up to the top of a paginated loop when a user goes to a new page of posts. There are cases where that would be more user-friendly. Any thoughts on this @eliot?

Yes thats what I want to say. It would be better if user goes to next page after clicking pagination page and also url changes in address bar.

Sure, that sounds useful. I’ve made a note to add an option to the loop pagination, where it scrolls to the top of the loop after navigating to a new page.

Changing the URL is more difficult - I think it can be done with URL query parameter, and should somehow support multiple paginated loops on the same page. That would let a user bookmark a URL that opens a specific page. OK, I’ve made a note of this too.

I’ll update this discussion thread when the features are implemented.

2 Likes

Is this actually coming? This is a feature I need, so I can switch from Custom Content Shortcode to Loops & Logic.
Cheers,
M

Hello,

The pagination feature now has an option to scroll to top when a new page is loaded.

<PaginateButtons scroll_top=true />

By default it does a “smooth scroll” effect. For details, please see the documentation page for Pagination, under Buttons: Scroll Top.

2 Likes