Skip Navigation

[Resolved] Scroll down according to sorting

This support ticket is created 3 years, 10 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/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by yannicN 3 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2020501

When I change the sort order of the display, the page automatically scrolls down and does not start at the top. On the first page it works correctly. On the following pages, unfortunately, it does not. I can't control it via the JavaScript triggers. If I change the filter values, it works correctly.

It concerns this page: hidden link

#2020635

Hi,

Thank you for contacting us and I'd be happy to assist.

I've checked the page and noticed that you've added some custom script to scroll to the top of the page, attached to the events "js_event_wpv_pagination_completed" and "js_event_wpv_parametric_search_results_updated".

On my test website with a similar view, the script executes correctly when the search results are updated through AJAX, as a result of sorting order change.
(irrespective of whether its the first page of the pagination or not)

It seems some other custom script or third-party code is interfering with this on your website.

Can you please test this with all extra (non-Toolset) plugins disabled and with a default theme like Twenty Twenty-One?

In case the issue still persists, you're welcome to share temporary admin login details so that I can see how this view is set up.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#2023195

Thank you for sharing these details.

During troubleshooting through script breakpoints in the browser console, I found some script in the active theme's file, which remembers the last scrolled position on the page and tries to restore it:
File: {yourwebsite.com}/wp-content/themes/dt-the7/js-lite/main.min.js

Can you please test the page's filters and sorting controls again by temporarily removing all the code from this file?

Once, it is confirmed that this code is responsible for the conflict, you can consult the theme's official support, to see if they can offer any fix or workaround.

#2023693

Hello Waqar,
I have cleared the contents of the corresponding file and tested it again. Unfortunately, the problem persists, so it stands to reason that the JavaScript file has no effect on the problem. You'll see it on the website. Can you please have another look? Thanks a lot!

#2025797

Thanks for the update and it is strange.

Can you please share a clone/snapshot of the website, so that I can troubleshoot this on a different server without, affecting the live website?
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

Note: I've set your next reply as private again.

#2029857

Thank you for waiting, while I performed some troubleshooting on your website's clone.

I noticed that even after updating the theme and plugins, the issue persisted. Moreover, it only happened when the "The7" theme was active. With a default theme like Twenty Twenty-One, the scroll to top script worked in all cases.

I wasn't able to narrow down exactly which code from the "The7" theme conflicts with it, however, using a slightly different scroll to top script worked with the theme, in my tests.

You'll find two instances of the following line in the custom scripts of your view "Alle Törns mit Suche und Filter":


window.scrollTo({ top: 0, behavior: 'smooth' });

You can replace both instances of that line with:


jQuery('html, body').animate({
        scrollTop: jQuery("body").offset().top
    }, 1000);

#2030795

My issue is resolved now. Thank you!