PX轉REM
阿新 • • 發佈:2018-10-29
color ont str ron add als fonts tel script
PX轉REM
<script> var clientWidth; var px; (function (doc, win) { var docEl = doc.documentElement, resizeEvt = ‘orientationchange‘ in window ? ‘orientationchange‘ : ‘resize‘, recalc = function () { clientWidth = docEl.clientWidth;var clientHeight = docEl.clientHeight; px = 100 * (clientWidth / 640); if (!clientWidth) return; docEl.style.fontSize = 100 * (clientWidth / 640) + ‘px‘; }; recalc(); if (!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc,false); doc.addEventListener(‘DOMContentLoaded‘, recalc, false); })(document, window); </script>
PX轉REM