【发布时间】:2015-04-12 12:57:58
【问题描述】:
这一定很常见......我很抱歉,但在这里找不到有效的解决方案......
我正在开发一个网站(改造),它具有响应式 CSS,例如:
/* Refecence from responsive.css
/* crank up to 5000px to support high res monitors and TV's */
@media only screen and (min-width: 1200px) and (max-width: 5000px)
/* Portrait tablet to landscape and desktop - BROWSER SIZE 2 */
@media only screen and (min-width: 991px) and (max-width: 1200px)
/* Landscape phone to portrait tablet - BROWSER SIZE 3 */
@media only screen and (min-width: 767px) and (max-width: 991px)
/* All Mobile Sizes (devices and browser) - BROWSER SIZE 4 */
@media only screen and (max-width: 767px)
/* Landscape phones and down - BROWSER SIZE 5 */
@media (max-width: 480px)
/* iphone portrait mode - BROWSER SIZE 6 */
@media (max-width: 320px)
我是新手,做了很多研究,但我有几个问题:
我计划有两个 HTML 块,一个隐藏,并使用 JS 或 CSS 根据用户是否在移动设备上隐藏适当的块。
我希望避免使用用户代理,因为太多了。默认情况下,Android 不再解析没有“电话:”的数字(根据其他帖子)。我在 Nexus 5 上进行了测试。另一方面,Firefox 要求设备在“电话:”链接上使用。
- 我可以使用我当前的@media CSS 块吗?如果是这样,视网膜呢?
- 或者基于用户代理的 JS 是否可以以某种方式解决?
- 其他选项,我的意思是大多数人都做什么???
感谢您的帮助。
【问题讨论】:
标签: javascript css mobile user-agent