Saltar navegación

[Resuelto] Scroll to top after AJAX pagination

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

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 hace 6 años. 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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por toolset-dave hace 6 años.

Asistido por: Nigel.

Autor
Mensajes
#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

Idiomas: Inglés (English ) Español (Español )

Zona horaria: 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.