Flexible vertical modal position

I have a site where my content is in an iframe. When I use a modal in that iframe it is vertically centered in the iframe, but the end result is that the modal is partially below the fold in the outer page.

We worked around this by applying a negative top margin to the modal, but that is somewhat fragile. To handle this kind of situation it would be useful to be able to give a (vertical) positioning hint, for example "top of the page".