首页 > 其他 > 详细

检测屏幕横屏状态

时间:2017-06-19 19:17:49      阅读:267      评论:0      收藏:0      [点我收藏+]

window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
    if (window.orientation === 180 || window.orientation === 0) {
      document.getElementsByTagName("html")[0].style.fontSize=document.documentElement.offsetWidth*12/375+"px"
    }
    if (window.orientation === 90 || window.orientation === -90 ){
      document.getElementsByTagName("html")[0].style.fontSize=document.documentElement.offsetWidth*12/375+"px"
    }
}, false);

检测屏幕横屏状态

原文:http://www.cnblogs.com/bluesky1024/p/7049914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!