• 移动页面缩放方法之(三)rem布局


    <!DOCTYPE HTML>
    <html lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
    <title>无标题文档</title>
    <style>
    *{
        padding:0;
        margin:0;    
    }
    body{
        background:#000;    
    }
    div{
        6.4rem;
        height:5rem;
        margin:0 auto;
        line-height:5rem;
        font-size:.3rem;
        text-align:center;
        color:#fff;
        background:red;    
    }
    </style>
    </head>
    
    <body>
    <div>我是测试的</div>
    <script>
    ;!function(top){
        var doc=top.document;
        top.SetSize=function(width){
            this.obj=doc.querySelector('html');
            this.width=width;
            this.fontSize=100;
            this.init().resize();
        };    
        SetSize.prototype={
            init:function(){
                this.scale=this.obj.clientWidth/this.width;
                this.obj.setAttribute("style","font-size:"+(this.scale*this.fontSize)+"px !important");
                return this;    
            },
            resize:function(){
                top.addEventListener('resize',this.init.bind(this),false);    
            }
        };
        SetSize.prototype.constructor=SetSize;
        doc.addEventListener('DOMContentLoaded',function(){
            new SetSize(640);
        },false);
    }(parent);
    </script>
    </body>
    </html>
  • 相关阅读:
    oracle 数据库安全审计
    oracle 共享服务器监控
    oralce MTS
    配置一个Oracle共享服务器进程环境需要哪两项参数
    python3 小技巧(2)
    python3 操作注册表
    PYC文件简介
    常见HTTP状态(304,200等)
    用Python模拟浏览器操作
    python3下的IE自动化模块PAMIE
  • 原文地址:https://www.cnblogs.com/tfbodys/p/5043443.html
Copyright © 2020-2023  润新知