打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
防止横竖屏时,iphone自动缩放的一段代码
userphoto

2013.09.18

关注

防止横竖屏时,iphone自动缩放的一段代码

function orientation_change() {    var viewport = document.querySelector('meta[name="viewport"]');    if (window.orientation == 0 || window.orientation == 180)        viewport.setAttribute("content", "width=device-width, maximum-scale=1.0, initial-scale=1.0, user-scalable=no");    else if (window.orientation == -90 || window.orientation == 90)        viewport.setAttribute("content", "width=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no");     }window.onorientationchange = orientation_change;

思路不错,记一下。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
检测iPhone/iPad设备方向的三种方法
手机端页面rem自适应脚本
网页head中加入下面一句代码可以使网站在手机端全屏显示
判断移动设备的横屏和竖屏最佳方案
浅谈h5移动端页面的适配问题
Web移动端实现自适应缩放界面的方法汇总
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服