200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > html 字号 宽度 像素 JS根据设备宽度设置根节点(html)font-size字体大小

html 字号 宽度 像素 JS根据设备宽度设置根节点(html)font-size字体大小

时间:2018-10-02 04:10:54

相关推荐

html 字号 宽度 像素 JS根据设备宽度设置根节点(html)font-size字体大小

JS根据设备宽度设置根节点(html)font-size字体大小

发布时间:-04-10 20:28:04

来源:51CTO

阅读:3210

作者:pmlinjian

JS根据设备宽度设置根节点(html)font-size字体大小

(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';

};

})();

/pa18shopnst/u/wx/product/bankCardSafe/index.shtml

/a/1190000004189237?_ea=522147

/flexible-js.html

/web-app-rem.html

http://huodong./act/yibo.html

http://121.40.99.17/global/rem-phone.html

头部像素

var scale = 1.0, ratio = 1, assetsHost = '', assetsVersion = '0.5.12', isTestEnv = false;

(function() {

if (location.host.match(/(waptest|wapa)\.taobao\.com$/i)) {

assetsHost = 'g.assets.';

assetsVersion = '0.5.12';

isTestEnv = true;

}

if (window.devicePixelRatio === 2 && window.navigator.appVersion.match(/iphone/gi)) {

scale = 0.5;

ratio = 2;

}

var text = ''

+ '';

document.write(text);

})();

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。