移动端rem设置
2016-05-09 本文已影响33人
极爷的皇纲
<script type="text/javascript">
(function(){
var resizeEvent = 'orientationchange' in window ? 'orientationchange' :'resize';
var rescale = function(){
document.documentElement.style.fontSize = document.documentElement.clientWidth / 640 * 20 +'px';
}
window.addEventListener(resizeEvent,rescale,false);
document.addEventListener('DOMContentLoaded',rescale,false);
})();
</script>