How to make a popup in the center of the screen regardless of the button position?



Hi, can anyone please help me with this problem.

I have 2 buttons which upon clicking it will show the same popup. One of the buttons at the top of the screen while another at the bottom which needs to scroll down. The problem is when I click the button at the very bottom of the page, the popup shows at the fixed position at the top which I need to scroll up to reach.
How to make the popup show at the center of the screen regardless of the scrolling?


When you say “popup”, are you talking about an Axure widget you’ve created or the “Open Link” > “OPEN IN = Popup Window” action?

If it’s an Axure widget, you can use “Window.scrollY” to get the scroll position. When I do popups like this, I put the positioning logic on the popup’s OnShow event:


This to [[(Window.width/2) - (This.width/2)]], [[Window.scrollY + 32]]


@huban Thank you so much for the guidance :smiley: . The concept works.


Note that sometimes this fails.

If you have various things showing / hiding, you may find it doesn’t pop up on the X axis where you would expect it to, because the system has gotten confused.

In those cases, I put a tiny, invisible reference rectangle in the middle of the screen and move my popup’s X axis to: refWidget.x-This.width/2

It’s just a bit of a hack for when the above approach stops working.


@JMW Thank you so much for the sharing :smiley: