Set variable to Y Position of a dynamic panel


Hi All,

I have another idea. Is this possible?

I have a Dynamic panel. How do I capture it’s Y position?
I was thinking OnPageLoad
VarYPosition (My global variable name) =

Is that right? or is it Scroll.Y ?

I then want to know, when the Dynamic panel moves down the Y Axis I do an action.

If Value of VarYPosition is greater than 1 // Do this action

It makes sense to me but I can’t see to execute it. Any help appreciated. Thank you.


You’re on the right track, but it looks like your code is a little off.

You could use the dynamic panel’s OnLoad interaction to set the variable to [[This.y]].

If you want to use OnPageLoad, you’ll have to reference the dynamic panel with a local variable. Ex: [[NameOfWidget.y]]

Widget_Coordinates.rp (56.0 KB)


Are you trying to make something happen once the user scrolls down the page to a certain point?

The y variable of a widget is calculated relative to the top of the canvas*, not relative to the top of the browser. So when you scroll down the page, the y value of a particular widget does not change. The value that does change is Window.scrollY.

So what you can do is something like this:
If Value of Window.scrollY is greater than or equals Widget.y // Do this action.

Do you have a sample file showing what you are trying to accomplish?


*This is only true for widgets that are placed on the canvas itself, and not inside a dynamic panel. In cases where a widget is contained inside a dynamic panel, the y value for that widget is calculated relative to the top of the containing panel