移动端适配
var refreshRem=(function refreshRem(){ var deviceWidth=document.documentElement.clientWidth; deviceWidth=Math.max(Math.min(420,deviceWidth),320); document.getElementsByTagName('html')[0].style.fontSize=(deviceWidth/750)*100+'px'; return refreshRem; })(); var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'; window.addEventListener(resizeEvt,refreshRem,false); @function rem($px){ @return $px / 100 + rem; }