zoukankan      html  css  js  c++  java
  • 首次加载动画

    1.JS逻辑

    <script type="text/javascript">
        window.onload = function(){
            setTimeout(function(){
                 $(".loading").fadeOut();
            },1000);
        };
        if(getCookie("id") == 1){
            //alert(123)
            document.querySelector(".loading").style.display = "none";
        }else {
            document.querySelector(".loading").style.display = "block";
            //alert(456)
        }
        setCookie("id","1",1);
        console.log(getCookie("id"))
        function getCookie(cname){
            var name = cname + "=";
                var ca = document.cookie.split(';');
                for(var i=0; i<ca.length; i++){
                var c = ca[i].trim();
                if (c.indexOf(name)==0) return c.substring(name.length,c.length);
            }
            return "";
        }
        function setCookie(cname,cvalue,exdays){
            var d = new Date();
            d.setTime(d.getTime()+(exdays*24*60*60*1000));
            var expires = "expires="+d.toGMTString();
            document.cookie = cname+"="+cvalue+"; "+expires;
        }
    </script>

    2.CSS样式

    <style>

    .circle {
        height: 10px;
         10px;
        background-color: #f88d19;
        border-radius: 100%; /* 将circle绝对定位,当上下左右都设置为0, 同时margin设为auto时,元素就将垂直水平居中 */
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        margin: auto;
        animation: dada 2s linear infinite; /*动画名称,持续时间,线性播放,无限持续*/
    }
    .circle:nth-child(2) {
        animation-delay: 1s;
    } /* 从0逐渐变为半径为100的圆,同时逐渐变得透明 */
    @keyframes dada{
            0% {
             height: 0px;
             0px;
             opacity: 1; /*透明度1,全部显示*/
            }
            100% {
            height: 100px;
             100px;
            opacity: 0; /*透明度0,看不见了*/
        }
    }
    .loading-box {
        height: 100px;
         100px;
    /*    border: 1px solid red; */
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        margin: auto;
    }
    .loading{
        position: fixed;
        background: #fff;
         100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 666666666;
        display: none;
    }

    </style>

    3.HTML结构

    <div class="loading">
        <div class="loading-box">
            <div class="circle"></div>
            <div class="circle"></div>
        </div>
    </div>

  • 相关阅读:
    PostgreSQL数据库逻辑复制实践
    CentOS7通过yum安装postgreSQL
    MongoDB动态建表方案(官方原生驱动)
    7大常用开源数据库利弊全对比
    错误:由于系统时间错误证书验证失败导致更新不成功
    deppin更新提示“由于没有公钥,无法验证下列签名”
    Debian 9 Vim无法使用鼠标右键复制 解决方法
    PHP版滑动时间窗口算法
    RabbitMQ PHP 代码示例
    创建或修改 docker 容器内部文件
  • 原文地址:https://www.cnblogs.com/wangshengli520/p/9924102.html
Copyright © 2011-2022 走看看