jquery是否适用于iphone的游猎? [英] Does jquery work on the iphone´s safari?

查看:115
本文介绍了jquery是否适用于iphone的游猎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个网站上工作,我使用slimbox2插件(类似于灯箱)为jquery生成照片放大。

I am working on a web-site where I use the slimbox2 plug-in (similar to lightbox) for jquery to generate photo enlargements.

该插件适用于我试过的每个浏览器除了iPhone上的Safari外。它在Safari for Windows上运行正常,但在iPhone上有两个问题:

The plugin works in every browser I have tried except for Safari on the iPhone. It does work as expected on Safari for Windows but on the iphone there are two problems:


  • 页面其余部分的变暗只会发生在页面顶部,关于视口的高度(假设页面顶部400px),下面的所有内容保持原样。

  • 较大的图像本身是准确地放在页面的中间,而不是视口的中间。

我在这里读过某个地方,认为jquery应该是在iphone上工作得很好但是由于定位和褪色似乎是基本的jquery功能,我想也许这不完全正确。它当然也可以是插件...

I have read somewhere here on SO that jquery is supposed to work just fine on the iphone but as positioning and fading seem to be basic jquery functionalities, I am thinking that maybe that is not completely true. It could of course also be the plugin...

所以我的问题是:jquery真的在iphone上工作,如果不是,有人知道如何制作它工作?

So my questions is: Is jquery really working on the iphone, and if not, does anybody know how to make it work?

非常感谢!

推荐答案

我知道这是超过一年半的时间,但以下这有助于其他任何人:

I know this is over a year and a half old, but here goes in case this helps anyone else:

我猜这可能是你的插件使用 position:fixed 既可以创建叠加层(您提到的页面变暗),也可以创建较大图像本身的容器。网站搜索位置:在Mobile Safari上修复将为您提供更多关于此主题的进一步阅读!

My guess is this is likely a problem with your plugin using position:fixed to both create the overlay (the "darkening of the page" you mentioned) as well as the container for the larger image itself. A web search for position:fixed on Mobile Safari will give you lots of further reading on this subject!

似乎因为Mobile Safari认为视口是整个页面而不仅仅是可见部分,position:fixed往往不能像我们期望的那样工作。我和另一个jQuery插件有同样的问题,它为我创建了一个模态窗口,其症状与你描述的非常相似。

It seems that because Mobile Safari considers the "viewport" to be the entire page rather than just the visible portion, position:fixed tends to not work as we would like to expect. I am having this same issue with another jQuery plugin that creates a "modal" window for me, with very similar symptoms as what you described.

我正在尝试通过以下方法解决这个问题:(A)消除位置:固定并更改为位置:绝对,而(B)手动设置高度和顶部基于body的整个高度和窗口的scrollTopjquery属性。我认为一些好的旧浏览器嗅探在这里可能会有所帮助,因为到目前为止这个浏览器只需要这个黑客。

I'm currently trying to work around this by (A)eliminating position:fixed and changing to position:absolute, while (B)setting heights and "top" manually based on the body's entire height and the window's "scrollTop" jquery property. I think some good old browser sniffing might be of help here, since this "hack" is only really needed for this one browser so far.

这篇关于jquery是否适用于iphone的游猎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆