你的位置:首页 > 软件开发 > 网页设计 > 移动端布局方案 网易

移动端布局方案 网易

发布时间:2017-03-24 12:00:11
移动端布局:rem方案:页面中的任何元素都采用rem布局,包括字体。 1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3 4 <head> 5 <meta charset= ...

移动端布局方案 网易

移动端布局:

rem方案:页面中的任何元素都采用rem布局,包括字体。

 1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3  4   <head> 5     <meta charset="UTF-8"> 6     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 7     <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> 8     <style type="text/css"> 9       * {10         margin: 0;11         padding: 0;12       }13       14       body {15         width: 7.5rem;16         font-size: 32px;17         font-size: .32rem;18         max-width: 1080px;19         margin: 0 auto;20         background: #f6f6f6;21         font-family: 'STHeiti', 'Microsoft YaHei', Helvetica, Arial, sans-serif;22         -webkit-tap-highlight-color: rgba(0, 0, 0, 0);23       }24     </style>25   </head>26 27   <body>28     <script type="text/javascript">29       var Dpr = 1,30         uAgent = window.navigator.userAgent;31       var isIOS = uAgent.match(/iphone/i);32       var isYIXIN = uAgent.match(/yixin/i);33       var is2345 = uAgent.match(/Mb2345/i);34       var ishaosou = uAgent.match(/mso_app/i);35       var isSogou = uAgent.match(/sogoumobilebrowser/ig);36       var isLiebao = uAgent.match(/liebaofast/i);37       var isGnbr = uAgent.match(/GNBR/i);38 39       function resizeRoot() {40         var wWidth = (screen.width > 0) ? (window.innerWidth >= screen.width || window.innerWidth == 0) ? screen.width :41           window.innerWidth : window.innerWidth,42           wDpr, wFsize;43         var wHeight = (screen.height > 0) ? (window.innerHeight >= screen.height || window.innerHeight == 0) ?44           screen.height : window.innerHeight : window.innerHeight;45         if(window.devicePixelRatio) {46           wDpr = window.devicePixelRatio;47         } else {48           wDpr = isIOS ? wWidth > 818 ? 3 : wWidth > 480 ? 2 : 1 : 1;49         }50         if(isIOS) {51           wWidth = screen.width;52           wHeight = screen.height;53         }54         if(wWidth > wHeight) {55           wWidth = wHeight;56         }57         wFsize = wWidth > 1080 ? 144 : wWidth / 7.5;58         wFsize = wFsize > 32 ? wFsize : 32;59         window.screenWidth_ = wWidth;60         if(isYIXIN || is2345 || ishaosou || isSogou || isLiebao || isGnbr) { //YIXIN 和 2345 这里有个刚调用系统浏览器时候的bug,需要一点延迟来获取61           setTimeout(function() {62             wWidth = (screen.width > 0) ? (window.innerWidth >= screen.width || window.innerWidth == 0) ?63               screen.width : window.innerWidth : window.innerWidth;64             wHeight = (screen.height > 0) ? (window.innerHeight >= screen.height || window.innerHeight ==65               0) ? screen.height : window.innerHeight : window.innerHeight;66             wFsize = wWidth > 1080 ? 144 : wWidth / 7.5;67             wFsize = wFsize > 32 ? wFsize : 32;68             document.getElementsByTagName('html')[0].style.fontSize = wFsize + 'px';69             document.getElementById("fixed").style.display = "none";70           }, 500);71         } else {72           document.getElementsByTagName('html')[0].style.fontSize = wFsize + 'px';73           document.getElementById("fixed").style.display = "none";74         }75       }76       resizeRoot();77     </script>78   </body>79 80 </html>

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:移动端布局方案 网易

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录