首页 > 其他 > 详细

页面自适应

时间:2018-08-17 10:46:15      阅读:153      评论:0      收藏:0      [点我收藏+]
 1 // 自适应
 2 function autoScreen(){
 3     var font_size = 40;
 4     var col_num = 640 / font_size;
 5     var adapterSize = window.innerWidth / col_num;
 6     var htmlElement = document.getElementsByTagName("html")[0];
 7     htmlElement.style.fontSize = ‘‘ + adapterSize + ‘px‘;
 8     
 9     window.onresize=function (){
10         adapterSize = window.innerWidth / col_num;
11         htmlElement.style.fontSize = ‘‘ + adapterSize + ‘px‘;
12     }
13 };
14 autoScreen();

 

页面自适应

原文:https://www.cnblogs.com/muou2125/p/9491896.html

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