根据屏幕大小及dpi调整缩放和大小

2016-08-25  本文已影响92人  结构学AI

<script>
//根据屏幕大小及dpi调整缩放和大小
(function() {
var scale = 1.0;
var ratio = 1;
if (window.devicePixelRatio >= 2) {
scale *= 0.5;
ratio = 2;
}
var text = '<meta name="viewport" content="initial-scale=' + scale + ', maximum-scale=' + scale +', minimum-scale=' + scale + ', width=device-width, user-scalable=no" />';
document.write(text);
document.documentElement.style.fontSize = 50
ratio + "px";
})();
</script>

上一篇 下一篇

猜你喜欢

热点阅读