Hi there,
Toolset support kindly supplied me with code to add to make our grids auto scroll to the top when clicking a pagination button...
jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
jQuery('html, body').animate({ scrollTop: (jQuery(".js-wpv-view-layout-32784").offset().top) - 180 }, 'slow');
});
The issue, this working fine on this View
hidden link
But not on this
hidden link
The View in question is a clone of the first, the only difference is the bottom one uses a shortcode to add to the page is its results are URL based.
The issue may be, one View is working hidden link and also hidden link
All using shortcode: [wpv-view name="destination" wpv-destination="norfolk" view_display="layout"] I change the destination to the location I need.
I guess the auto scroll code is having an issue however its js-wpv-view-layout-32784 is set to the one view powering both.
A bit stuck as to what do do ref this.
Many thanks.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Pete,
Thank you for getting in touch.
If you want this code to work on your other views you need to add it like this.
jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
jQuery('html, body').animate({ scrollTop: (jQuery(".js-wpv-view-layout").offset().top) - 180 }, 'slow');
});
Setting it to a class that is common to all the views. When you use the class .js-wpv-view-layout-32784 the code is going to look for this class to scroll to. However given that this view is not on the page then it won't be able to scroll to it.
Please try this and let me know if it helps.
Thanks,
Shane
My issue is resolved now. Thank you!