Skip Navigation

[Resuelto] Scroll to top on pagination when there a multiple paginated views in a page

This support ticket is created hace 6 años, 6 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Etiquetado: ,

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por Tim Elliott hace 6 años, 6 meses.

Asistido por: Shane.

Autor
Mensajes
#906309

Hi Support team,

I have a page with multiple views embedded in it.
View 1 is a slider view (which uses pagination for the slides to work).
View 2 is a list of posts with standard pagination.

I've added the following code to make the page scroll to the top of View 2 (id="scrolltop") when the user clicks the pagination:

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
    /**
    * data.view_unique_id (string) The View unique ID hash
    */
    document.getElementById('scrolltop').scrollIntoView(true);
});

Unfortunately View 1's automatic sliding also triggers this pagination and scrolls the page down to the start of View 2.

Is there a way to isolate the different pagination events so that the page only scrolls of the manual pagination?

Thanks

#906448

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Tim,

Thank you for contacting our support forum.

This code is suppose to scroll it back to the scrollToTop div after the pagination correct?

Would you mind providing me with a link to the site so that I can have a look ?

Thanks,
Shane

#906774

Hi Shane

I'll need to give you login details to view the site - can you set me a private reply.

Thanks
Tim

#906779

Hi Shane

I've recreated the problem on a site you can access:

enlace oculto

At the top is a Slider View that shows 3 images (with no manual transition).

Below it is a Site Archive View that has pagination. When you scroll right down to the Site Archive View pagination and change pages, the page scrolls to the top of the site archive view (this is the desired effect).

But when you click prev/next on the slider the page also scrolls to the top of the Site Archive View.

I need my Jquery to only act when the Site Archive View pagination is used.

I hope that makes sense.

Thanks
Tim

#907092

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Tim,

Could you try adding this to your callback ?

data.view_unique_id

This should provide you with the ID of the view that this callback is in. Then you can wrap this document.getElementById('scrolltop').scrollIntoView(true); in an if statement.

What I recommend that you do is to add .

console.log(data.view_unique_id)

To your callback and find the unique ID of the view in the console and then you can just use an if statement to check for that unique id.

Please let me know if this helps.

Thanks,
Shane

#907134

Hi Shane

Got there with that info.

Thanks
Tim