Navigation überspringen

[Gelöst] Scroll to top after AJAX pagination

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
How to scroll back to the top of the page after paginating a View?

Solution:
Add the following code which makes use of the custom JS events provided by Views which can be inserted using the Front-end events button on the custom JS editor of the Search and Pagination section of a View:

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
  jQuery("html, body").animate( {scrollTop: 0}, "fast");
});
This support ticket is created vor 6 Jahren. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von toolset-dave vor 6 Jahren.

Assistiert von: Nigel.

Author
Artikel
#1191830

Hi,

is there any way how to go up and show first post on page after AJAX pagination? I have the buttons bellow the posts and by default it stays on the same place, so it is not comfortable for users.

#1191896

Nigel
Supporter

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: Europe/London (GMT+00:00)

You can add the following JS to the custom JS section of your View, that should do it:

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
  jQuery("html, body").animate( {scrollTop: 0}, "fast");
});
#1191942

Hi Nigel,

thank you, it works nice.