Get the Scroll amount for a RG Scroll To Entry

I have a RG and when the user clicks, I use the Scroll To Entry option. It works, fine.

When the user is done, I’d like to scroll the RG back to the original position. Is there any trick to either scroll back to the original position or at least to find out how many pixels the Scroll To Entry moved the display?

Thanks.

Hi there, @ken1… you are able to get the current page scrolling position via an operator, so I’m thinking you could save that position to a custom state before you scroll away from it, and then you could go back to it by using the toolbox plugin and some javascript (I do that in one of my apps).

Hope this helps.

Best…
Mike

1 Like

Thank you. That is exactly what I was looking for. I was looking for something related to the repeating group, not the page so I overlooked it.

I’ll give it a try and report my results here. Thanks for the tip!


UPDATE: I tried the suggestion and I’m afraid it will not work. I seem to have two options.

  1. I can scroll to entry of a repeating group, but I don’t know which entry to scroll to.
  2. I stored the current page position before scrolling, but I cannot scroll back to that because I cannot provide a dynamic value.

So frustrating! Anyhow, thanks for the idea. I’m gonna let this one go for now…

Screenshot 2024-01-21 at 4.43.36 PM

1 Like

As I mentioned, you can use the toolbox plugin. Use the Run javascript action, and set the script to window.scrollTo(0,YourDynamicValueHere);.

2 Likes

Ah. I overlooked the last part. I think I need a break!

Thanks. I’ll give it a try.


UPDATE: That worked perfectly! Thank you.

Can I use JS to animate the scroll or do I need to use CSS? I have the open scroll animated so it would be great to match that with the return animation.

1 Like

Happy to hear it’s working for you… not sure how to animate the scroll.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.