JS set root node (HTML) font-size font size based on device width
(function () {
Document.addeventlistener (' domcontentloaded ', function () {
var devicewidth = document.documentElement.clientWidth;
Document.documentElement.style.fontSize = devicewidth/6.4 + ' px ';
}, False);
Window.onresize = function () {
var devicewidth = document.documentElement.clientWidth;
Document.documentElement.style.fontSize = devicewidth/6.4 + ' px ';
};
})();
Http://baoxian.pingan.com/pa18shopnst/u/wx/product/bankCardSafe/index.shtml
1190000004189237?_ea=522147
Http://caibaojian.com/flexible-js.html
Http://caibaojian.com/web-app-rem.html
Http://huodong.m.taobao.com/act/yibo.html
Http://121.40.99.17/global/rem-phone.html
Head pixel
<script type= "Text/javascript" >
var scale = 1.0, ratio = 1, Assetshost = ' g.tbcdn.cn ', assetsversion = ' 0.5.12 ', istestenv = false;
(function () {
if (Location.host.match (/(Waptest|wapa) \.taobao\.com$/i)) {
Assetshost = ' g.assets.daily.taobao.net ';
assetsversion = ' 0.5.12 ';
Istestenv = true;
}
if (window.devicepixelratio = = = 2 && window.navigator.appVersion.match (/iphone/gi)) {
scale = 0.5;
Ratio = 2;
}
var text = ' <meta name= ' viewport "content=" initial-scale= ' + scale + ', maximum-scale= ' + scale + ', minimum-scale= ' + S Cale + ', User-scalable=no '/> '
+ ' <link ' + ' type= "text/css" rel= "StyleSheet" href= "http//' + assetshost + '/mtb/app-index/' + assetsversion + '/index ' + ratio + '. css ' + '/> ';
document.write (text);
})();
</script>
JS set root node (HTML) font-size font size based on device width