Skip Navigation

[Résolu] Scroll to top after AJAX pagination

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 5 années et 10 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 5 années et 10 mois.

Assisté par: Nigel.

Auteur
Publications
#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

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: 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.