杂乱记忆

设备宽度设置 禁止屏幕放缩

<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>
html/css
JSRUN前端笔记, 是针对前端工程师开放的一个笔记分享平台,是前端工程师记录重点、分享经验的一个笔记本。JSRUN前端采用的 MarkDown 语法 (极客专用语法), 这里属于IT工程师。