浏览器在监听改变窗口大小时候的变化

font_width();
$(window).on("resize", function(){
  font_width();
});
function font_width (){   var clientWidth = document.documentElement ? document.documentElement.clientWidth : document.body;   if (clientWidth
< 768) {     var font = clientWidth*40/750 > 40 ? 40 : clientWidth*40/750;     $("html").css("font-size", font+"px");   } else {     $("html").css("font-size", "16px");   } }

 

posted @ 2018-03-29 12:19  白纱茗-度C  阅读(297)  评论(0编辑  收藏  举报