这个其他系统都没问题,就是iOS9不行
<script>
const maxWidth = 750
function setRem(){
let htmlEle = document.querySelector('html')
let docWidth = document.documentElement.clientWidth
let realWidth = docWidth > maxWidth ? maxWidth : docWidth
htmlEle.style.fontSize = realWidth / 7.5 + 'px'
}
setRem()
window.addEventListener('resize', setRem, false)
</script>
后来Google找到了个,换上去看,啊,真的解决了
<script>
;(function (doc, win) {
var docEl = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function() {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
if ( clientWidth > 500) {
clientWidth = 500;
}
docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
};
if (!doc.addEventListener) {
return;
} else {
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
}
})(document, window);
</script>
代码来源:http://www.cnblogs.com/bagnliu/p/8288501.html
正文完
要饭中,多少给点吧(支付宝)