Skip Navigation

[Résolu] Executing javascript animation (scrollTop) after parametric search is submitted

This support ticket is created Il y a 7 années et 2 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 réponse, has 1 voix.

Last updated by joshM-4 Il y a 7 années et 2 mois.

Auteur
Publications
#490575
Screen Shot 2017-02-17 at 9.32.33 AM.png

I am trying to: automatically scroll to the top of the view, which is in an element with the id of $results, after the "next" or "prev" links are clicked to paginate using Java. (I'm now realizing the title I gave this issue doesn't match the issue I'm describing here).

I visited this URL: hidden link

I expected to see: The page scroll to the top of the #results area after clicking the "next" or "prev" links.

Instead, I got: The page stayed in the same spot - at the bottom of the #results area.

Here's what I have at this point. I'm using the JS Editor within the Filter Editor for the view. I clicked the "Frontend events" button which loaded the 'js_event_wpv_pagination_completed' function and I inserted my jQuery inside it. Here it is in it's entirety:

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
	jQuery('html, body').animate({ scrollTop: $('#results').offset().top }, 100);
});

It's not working and I'm not sure why. If I just use the following it will take it to the top of the page, or I can change the pixel amount to offset it, but I want it to go straight to the top of the element with the id #results.

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

Any help you can offer is greatly appreciated!

#490584

Geeze - I figured it out. I wasn't paying attention to the "$" that needed to be "jQuery"

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.