Rails / Prototype - Modalbox 对话框居中问题
我有一个问题,原型模态框对话框未完全显示在用户的浏览器中,具体取决于用户的屏幕分辨率。例如,Modalbox 中的部分内容被浏览器视口截断,用户无法查看。
我相信这与内容和 Modalbox 加载的顺序有关。例如,生成 Modalbox 对话框,然后加载内容 - 这最终导致对话框不在用户的浏览器视口中居中。
我想知道是否还有其他人遇到过这个问题?如果是这样,您正在以编程方式做什么来确保对话框以最佳方式显示?
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 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我记得有这个问题。通常当 ModalBox 不知道它正在加载的内容的宽度/高度时,就会发生这种情况。这些步骤有帮助(无需应用所有步骤,尝试看看什么最适合您):
1) 将 ModalBox 中显示的内容包装在 DIV 中,并为其设置高度/宽度 CSS 属性。
2) 确保 ModalBox 内容中是否有图像,并且它们的宽度高度也已设置。
3) 在显示 ModalBox 之前预加载内容。
4)使用ModalBox回调(onShow,如果我没记错的话),并调用该函数将其重新设置为中心。
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.