HTML5 mobile boilerplate建议添加此Javascript片段以修复“iPhone视口缩放错误”:
// Fix for iPhone viewport scale bug
// http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
MBP.viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]');
MBP.ua = navigator.userAgent;
MBP.scaleFix = function () {
if (MBP.viewportmeta && /iPhone|iPad|iPod/.test(MBP.ua) && !/Opera Mini/.test(MBP.ua)) {
MBP.viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
document.addEventListener("gesturestart", MBP.gestureStart, false);
}
};
MBP.gestureStart = function () {
MBP.viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
};
答案 0 :(得分:3)
使用iPhone查看此demo page。将手机从纵向旋转到横向。请注意页面在横向视图中放大。
请参阅此处详细了解http://webdesignerwall.com/tutorials/iphone-safari-viewport-scaling-bug
也检查评论。
此屏幕截图也应该有所帮助: http://webdesignerwall.com/wp-content/uploads/2011/09/iphone-viewport-scaling-bug.png