jqModal 在 Mobile Safari 中显示不正确
我的网站上有一个 jQModal 窗口,其内容由 Ajax 调用填充。 它在所有桌面浏览器中工作正常,但在 iPhone 上的 Mobile Safari 中失败。
覆盖层和窗口本身显示在页面主体的顶部,而不是覆盖 iPhone 视口。 如果向上滚动,您可以看到窗口和覆盖层的位置与在任何其他浏览器中一样。 这尤其成问题,因为对于 Mobile Safari 的用户来说,一旦他们向下滚动并单击拉起模式窗口,就没有任何响应 - 屏幕上带有模式窗口的部分对用户来说是完全不可见的。
我很确定这是因为 jqModal 在其 CSS 中使用了“position:fixed”,而由于各种原因,它在 iPhone 上是 effd 的。 这是一篇很好的博客文章,描述了原因: http://doctyper.com /archives/200808/fixed-positioning-on-mobile-safari/
我查看了其他一些模式窗口库(例如 BlockUI),它们在 Mobile Safari 中也有同样的问题。 有谁知道如何修改 jqModal js/css 来解决这个问题? 干杯
I have a jQModal window on my site that has its content populated by an Ajax call. It works fine in all of the desktop browsers, but it fails in Mobile Safari on the iPhone.
The overlay and the window itself are displayed on the top of the body of the page, rather than covering the iPhone viewport. If you scroll up, you can see the window and the overlay positioned as in any other browser. This is especially problematic because, for a user of Mobile Safari, once they scroll down and click to pull up the modal window, there is no response whatsoever - the part of the screen with the modal window is completely invisible to the user.
I'm pretty sure this is because jqModal uses "position: fixed" in its CSS, which is effd on the iPhone for various reasons. Here's a good blog post describing why: http://doctyper.com/archives/200808/fixed-positioning-on-mobile-safari/
I've looked at some of the other libraries for modal windows (such as BlockUI) and they have the same issue in Mobile Safari. Does anyone know how to modify the jqModal js/css to fix this? Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一种黑客但不错的解决方法。 我看到 jqmodal 将模式放在页面顶部,因此此代码在打开模式后只需滚动到顶部:
中的
open
函数中我将其添加到jqmodal.js SimpleModal 附带的演示,它们似乎在 iPad/iPhone 上可以正常工作,因此迁移到 iPad/iPhone 将是另一种解决方案:
http://www.ericmmartin.com/projects/simplemodal/
This is sort of a hack but decent work around. I'm seeing jqmodal put the modal at the top of the page, so this code simply scrolls to the top after they open a modal:
I added this to the
open
function in jqmodal.jsFrom trying the demos that come with SimpleModal, they seem to work correctly on iPad/iPhone so migrating to that would be another solution:
http://www.ericmmartin.com/projects/simplemodal/
也许尝试这样的方法来定位模态 div ?
作者:乔恩·布里斯宾
Maybe try something like this to position the modal div?
Via Jon Brisbin