我目前正在构建一个针对移动设备优化的网站。
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
我有一个动态 javascript 网格,我不希望在移动设备上进行缩放。
上面的行在 iphone 上完美运行,但我认为它不适用于 android 或 webos。我怎样才能为这些移动设备设置 NO-SCALE 模式。所以没有双指缩放并且设备宽度是 100% 浏览器宽度?
最佳答案
根据 http://developer.android.com/guide/webapps/targeting.html#Metadata ,“user-scalable”属性需要设置为“no”,而不是0。所以:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
编辑:页面底部附近的更多信息 Safari Reference Library - Supported Meta Tags :
user-scalable
Determines whether or not the user can zoom in and out—whether or not the user can change the scale of the viewport. Set toyes
to allow scaling andno
to disallow scaling. The default isyes
.Setting
user-scalable
tono
also prevents a webpage from scrolling when entering text in an input field.Available in iOS 1.0 and later.
关于iphone - android 和 webos 没有内容缩放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4402844/