zoukankan      html  css  js  c++  java
  • html 使用rem开发

     window.onload = function () {
                var ohtml = document.getElementsByTagName("html")[0];
                var widthMax = document.documentElement.clientWidth;
                if (widthMax > 750) {
                    ohtml.style.fontSize = '100px';
                }
                else {
                    ohtml.style.fontSize = (widthMax / 750) * 100 + 'px';
                }
            }

    html 默认字体 100px

        $(function () { loadlogininfo(); });
    
        //html root的字体计算应该放在最前面,这样计算就不会有误差了/
        //2016.3.23 wjq update 之所以要加个判断返回一个20.5,是因为当用户在谷歌等浏览器直接输入手机端网站网址时,如果用户设置模块自定义样式的高度比较小,由于这时候的clientWidth为1920px,及返回的_htmlFontSize为40,这时候就会使模块太小,展示不完全,因此先取一个较为准确的值去展示。Mobi.resetHtmlFontSize()顺便也加了
        var _htmlFontSize = (function () {
            var clientWidth = document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth;
            //if(clientWidth > 768) clientWidth = 768;
            if (clientWidth > 768 && clientWidth < 1280) {
                clientWidth = 768;
            } else if (clientWidth >= 1280) {
                clientWidth = 512;
            }
            document.documentElement.style.fontSize = clientWidth * 1 / 16 + "px";
            return clientWidth * 1 / 16;
        })();
  • 相关阅读:
    jquery获取当前时间比较日期
    php获取时间计算时间差
    计数查询统计
    jQuery选取所有复选框被选中的值并用Ajax异步提交数据
    在java中实现对access数据库的远程访问
    sublime快捷键
    局部变量和成员变量的区别
    常见的几种数组排序方法
    JVM的内存划分
    Java函数
  • 原文地址:https://www.cnblogs.com/prolion/p/9223457.html
Copyright © 2011-2022 走看看