Skip Navigation

[Closed] Scroll to top of table vs top of page after Ajax pagination

This support ticket is created 2 years, 2 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.

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 2 years, 2 months ago.

Author
Posts
#2292845

Tell us what you are trying to do?
After using the Ajax pagination to go to the next page, would like for it to scroll to the top of the table -- not the top of the page.

Found this thread with the JS that scrolls it back to the top:
https://toolset.com/forums/topic/scroll-to-top-after-ajax-pagination/

Is there a way to adjust this to scroll up to a different point?

#2293139

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Lisa

My understanding is that because it is the body of the page that is scrolled when you look at the results lower down the page—and for which a scrollbar is added—it is the body of the page for which the scroll position needs resetting.

The simplest solution is to simply add a static value for the scrollTop offset in the solution from the other thread, based upon the size of your header and any content that appears before the View, e.g. 300 (px).

But that may vary by screen size, so if you want it to be more accurate you would need to inspect the page source to locate the identifier of an element you want to scroll to, and then calculate its position relative to the top of the page, so that you can set the scrollTop offet in the code to that calculated value.

(There are many articles online about calculating the position, e.g. hidden link)

The topic ‘[Closed] Scroll to top of table vs top of page after Ajax pagination’ is closed to new replies.