移动Safari窗口报告980像素 [英] Mobile Safari window reports 980px

查看:54
本文介绍了移动Safari窗口报告980像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么此报告在iPhone 4上显示980?我以为会是960或640.

Why does this report 980 on the iPhone 4? I thought it would be 960 or 640.

alert($(window).width());

推荐答案

您将获得默认的视口设置.参见 Apple iOS文档-元标记并搜索视口".

You're getting the default viewport setting. See Apple iOS docs - meta tag and search for 'viewport'.

属性说明

width 视口的宽度(以像素为单位).默认值为980.范围是200到10,000.您也可以将此属性设置为数字"中描述的常量. 在iOS 1.0和更高版本中可用.

width The width of the viewport in pixels. The default is 980. The range is from 200 to 10,000. You can also set this property to the constants described in "number." Available in iOS 1.0 and later.

根据文档获取设备宽度:

To get the device width, as per the docs:

例如,要将视口宽度设置为设备的宽度,请将其添加到HTML文件中:

For example, to set the viewport width to the width of the device, add this to your HTML file:

<meta name="viewport" content="width=device-width" />

这篇关于移动Safari窗口报告980像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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