Tell us what you are trying to do?
I am trying to get a custom search to scroll to the search results. It works on the same page (hidden link), as I'm using the jquery trigger when the search begins. But when coming from a separate page, the scroll doesn't work, as it looks like the search isn't triggered, it just adds the search to the search bar.
I would like it to trigger the search from the first page (hidden link) as well as the other page that it's on. Is this possible?
Is there any documentation that you are following?
I used this thread to see if there was anything that might work: https://toolset.com/forums/topic/js-frontend-events-after-pagination-and-search/
What is the link to your site?
hidden link
Hello,
There isn't such a built-in feature within Views plugin, as you can see it needs custom JS codes, I suggest you try to use Jquery animate() function to scroll the window, like this:
( function( $ ) {
// when page is loaded
$("a.js-wpv-pagination-previous-link, a.js-wpv-pagination-next-link").click(function(e){
$([document.documentElement, document.body]).animate({
scrollTop: $("#search-results").offset().top
}, 2000);
});
// when ajax pagination is completed
$( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
$("a.js-wpv-pagination-previous-link, a.js-wpv-pagination-next-link").click(function(e){
$([document.documentElement, document.body]).animate({
scrollTop: $("#search-results").offset().top
}, 2000);
});
});
})( jQuery );
More help:
hidden link