Skip Navigation

[Resolved] After previous or next pagination link scroll to the top of the div not the page

This support ticket is created 4 years, 5 months ago. 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
- 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)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Rita 4 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1672871

In my view (Pagination enabled with manual transition and AJAX) I have pagination links displayed below the loop in the loop editor. I also have a little js snippet in the loop editor js box to make the pagination scroll to the top of the page when the user clicks the Previous or Next pagination links like so:

jQuery(document).on('click','.wpv-filter-previous-link,.wpv-filter-next-link', function() {
$('html, body').animate({ scrollTop: 100 }, 'fast');
});

I would like the 'scroll to top' function to scroll to the top of a particular location. Lets say, for example, a div (by id?) that would wrap the view in the the loop editor itself or in the template where the view is displayed. Or to an anchor or similar.

I have tried all the other 'scroll to specified location' ideas in other threads but cannot seem to get any to work.

Unfortunately, I am not very deft with jQuery... and am hoping you can help me out?
Many thanks in advance!
Rita

#1673685

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Rita,

Try using the proper callback functions for the AJAX pagination action.


jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.effect (string) The View AJAX pagination effect
	* data.speed (integer) The View AJAX pagination speed in miliseconds
	* data.layout (object) The jQuery object for the View layout wrapper
	*/
	jQuery('html, body').animate({ scrollTop: 100 }, 'fast');

});

This should work fine now.

Thanks,
Shane

#1673983

Ah ok thank you very much Shane. Yes, that works beautifully.

#1673985

My issue is resolved now. Thank you!