Unfortunately I didn't keep any of my attempts to make this work and just set the script back to the original till I could get it resolved. But I guess I just need help modifying this script with what Bob suggested so that it works:
jQuery(document).on('click','.wpv-filter-previous-link,.wpv-filter-next-link', function() {
$('html, body').animate({
scrollTop: ($('.filter-submit').offset().top)
},700);
});
Is that something you can help with or should I post elsewhere and ask for help? I understand if you can't.
Hi Sam,
Adriano's possibly gone for the weekend now.
Try the following:
In the JS section of your view...
jQuery(document).on( 'js_event_wpv_pagination_completed', function() {
jQuery('html, body').animate({
scrollTop: jQuery('#scroll-div').offset().top
},700);
});
Note: Don't use the $ shortcut for jQuery.
To set the scroll position set the id on an element in your view html which defines the top of the scroll visibility area.
If you don't have an existing element you can just add a new (hidden) one with the id...
<div id="scroll-div" style="display: none;"></div>
Hope that works for you.
Cheers,
Bob
Thank you @bob.
@sam, let us know how it goes.
Sam,
I should not have set the div style to display: none; in the sample code above.
So put your id in an existing element or add a new element but don't make the style display: none;
Cheers,
Bob
Ah, that was it. Thank you Bob and Adriano! I tried lots of different combinations so I'm not sure exactly what I did wrong but I know I wasn't aware to not use the $ shortcut for jQuery so that may have been it ... I'm not very good with JS.
Thank you very much for your help!