zoukankan      html  css  js  c++  java
  • 手机端适配font-size ,弹窗样式

    手机端适配

    手机根据相应的屏幕大小 使用不同的font-size

    (function(doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function() {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth) return;
                docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
            };
        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);
    

    手机端弹窗

                //HTML
    <div class="tips" style="display: none">
            <div></div>
    </div>
                // CSS
    .tips {
        position: fixed;
        top: 42%;
         100%;
        left: 50%;
        text-align: center;
        z-index: 999;
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
    }
    .tips>div {
        display: inline-block;
        margin: 0;
        padding: 0.2rem 0.3rem;
        text-align: center;
        color: #fff;
        font-size: 0.6rem;
        text-shadow: 1px 1px 1px #000;
        border-radius: 50px;
        /*line-height: 1.5rem;*/
        background: rgba(0,0,0,.8);
    }
                // JS
    function showTips(text) {
        $('.tips>div').text(text).parent().fadeIn().fadeOut(2000);
    }
    
    咫尺远近却无法靠近的那个你,才敢让你发觉你并不孤寂
  • 相关阅读:
    HDOJ/HDU 2352 Verdis Quo(罗马数字与10进制数的转换)
    HDOJ/HDU 2203 亲和串(简单的判断~Java的indexOf()方法秒)
    HDOJ/HDU 2163 Palindromes(判断回文串~)
    js之函数
    js琐碎知识点
    position
    css属性background
    图片展示失效容错处理
    文字打点
    浮动的一些知识点
  • 原文地址:https://www.cnblogs.com/tcz1018/p/13595253.html
Copyright © 2011-2022 走看看