Rails / Prototype - Modalbox Dialog Centering Issues
I have an issue with the Prototype Modalbox Dialog not fully displaying in the user's browser, depending upon the user's screen resolution. For example, part of the content in the Modalbox is cut off by the browser viewport, and there's no way for the user to view it.
I believe it has something to do with the sequence of the content and Modalbox being loaded. For example, the Modalbox Dialog is generated, THEN the content is loaded -- this ultimately results in the Dialog not being centered in the user's开发者_JS百科 browser viewport.
I am wondering if anyone else has ran into this issue? If so, what are you programmatically doing to make sure that the Dialog display optimally?
I remember having this issue. Usually it happens when ModalBox doesn't know the width/height of the content that it's loading. These steps help (no need to apply all of them, try and see what works best for you):
1) Wrap the content that will be shown in ModalBox in a DIV and set the height/width CSS properties for it.
2) Make sure that if there are images in the ModalBox content, that they have the width height also set.
3) Preload the content before you even display the ModalBox.
4) Use ModalBox callbacks (onShow if I remember correctly), and call the function to recenter it.
精彩评论