Skip to main content
ZetiSam
Participant
February 1, 2018
Question

Reset ModalDialog position onscreen

  • February 1, 2018
  • 0 replies
  • 309 views

I have a main extension that depending on the situation and context can open up some modal dialogs.

For one of those dialogs, the optimal size is not fixed and depends heavily on the context:

* User screen size

* Content height & width

The modal opens at 150 x 150px and starts loading its contents. Once this is loaded in the background, I can calculate the desired size of the modal.

Using these calculated sizes and the CSInterface.resizeContent method I'm able to set the modal to its ideal size.

The only issue here is that the modal is no longer centered after resizing.

So the initial modal of 150 x 150px is dead center (which I like), but after resizing the top-left corner will remain in the same place and modal will overflow off the screen, requiring the user to reposition it.

So I'm looking for a way to set my modal in the center again, after resizing. I didn't find anything in the CSInterface.

Is something like this possible?

This topic has been closed for replies.