设备宽度设置 禁止屏幕放缩
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
定义手机端整体宽度7.5rem 代码需要放在body当中
<div id="node" style="width:1rem;"></div>
<script id="threadReside">
var _winWidth = document.documentElement.clientWidth || document.body.clientWidth, _style = document.getElementsByTagName("html")[0].style;
if (_winWidth == 0) {
if (window.localStorage && window.localStorage.getItem("WEBVIEW_WIN_WIDTH") != null) {
_winWidth = window.localStorage.getItem("WEBVIEW_WIN_WIDTH");
} else {
_winWidth = 320;
}
} else {
if (window.localStorage)
window.localStorage.setItem("WEBVIEW_WIN_WIDTH", _winWidth);
}
_winWidth >= 750 ? _style.fontSize = "100px" : _style.fontSize = _winWidth / 7.5 + "px";
_style.fontSize = parseFloat(_style.fontSize) * parseFloat(_style.fontSize) / document.getElementById("node").clientWidth + "px";
</script>