多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### `Window.innerWidth` > 浏览器视口(viewport)宽度(单位:像素),如果存在垂直滚动条则包括它。 #### 问题1:iphone在文档加载完成前后,`window.innerWidth`值不一样 ```html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no minimal-ui"> </head> <body> <div class="wrapper"> </div> <script> console.log(window.innerWidth); // iphone6s plus => 980 window.onload = function() { console.log(window.innerWidth); // iphone6s plus => 414 } </script> </body> </html> ``` 解决方法: ```html <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1, shrink-to-fit=no"> ``` * [关于shrink-to-fit](http://www.jianshu.com/p/d0d8d2195572)