Problem:
The user has an AJAX-based search view and he would like to scroll down to the results after an AJAX search completes
Solution:
Rely on the view's Javascript events to execute a scroll-down command to the element that holds the results:
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) { /** * data.view_unique_id (string) The View unique ID hash * data.layout (object) The jQuery object for the View layout wrapper */ console.log('results updated'); jQuery('html, body').animate({ scrollTop: jQuery(".js-wpv-loop-wrapper").offset().top - 70 }, 1000); });
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/
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.
This topic is split from https://toolset.com/forums/topic/display-a-view-filter-selection-visually/
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - | - | 9:00 – 13:00 |
14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - | - | 14:00 – 18:00 |
Supporter timezone: Africa/Casablanca (GMT+01:00)
This topic contains 4 replies, has 2 voices.
Last updated by 3 years, 10 months ago.
Assisted by: Jamal.