位置特征检测:固定 [英] Feature detection for position: fixed

查看:80
本文介绍了位置特征检测:固定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找一个脚本,用于检测设备是否放置位置:固定相对于ViewPort的元素,而不是整个文档。

I am trying to find a script that detects if a device places position: fixed elements relative to the ViewPort and not to the entire document.

目前,标准桌面浏览器和Mobile Safari(适用于iOS 5)这样做,而Android设备将固定元素相对于整个文档放置。

Currently, standard desktop browsers and Mobile Safari (for iOS 5) do so, whereas Android devices place the fixed elements relative to the entire document.

我找到了几个检测这个的测试,但似乎都没有用:

I have found a couple of tests to detect this, but none of the seem to work:

  • http://kangax.github.com/cft/ Gives me a false positive when I pass it from an Android device.
  • https://gist.github.com/1221602 Gives me a false negative when I pass it in an iPhone with iOS 5.

是否有人知道在哪里找到/如何编写实际的测试检测到了吗?我不想依赖浏览器嗅探。

Does anybody know where to find / how to write a test that actually detects that? I don't want to rely on browser sniffing.

推荐答案

根据现代化者,如果不检测正在使用的浏览器,则无法执行此操作。贡献者在该领域非常成熟。

According to the contributors at Modernizr, you cannot do this without detecting the browser in use. The contributors are quite well-established in the field.

在iOS和Android设备上测试位置:固定是在Modernizr项目的 Undetectables wiki页面下列出。

Testing for position: fixed on iOS and Android devices is listed under the Undetectables wiki page in the Modernizr project.

MobileHTML5网站列出了对位置的支持:已修复 http://mobilehtml5.org/

这篇关于位置特征检测:固定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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