Skip Navigation

[Resolved] Trigger window scroll from separate page

This support ticket is created 5 years, 3 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 – 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1184785

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

#1184953

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

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.