js 页面增加过渡层

可直接使用下面代码,gif动图需要自己查找,可以使用此网站生成动图https://www.intogif.com/loading/

<!-- 基础样式 -->
 <style>
    #loading {
        position: fixed;
        width: 100%;
        height: 100%;
        background: #ffffff;
        z-index: 1;
        top: 0px;
        left: 0px;
        color: #000000;
    }

    #loading .item {
        text-align: center;
        width: 300px;
        height: 100px;
        margin: auto;
        position: absolute;
        top: 0px;
        bottom: 0px;
        left: 0px;
        right: 0px;
    }

    .loadingNone {
        display: none;
    }

    #loadingContainer .loading{
        width: 12%;
        margin-bottom: 12px;
    }

</style>
    
<!--    过渡层 --start -->
    <div id="loading">
        <div class="item">
            <img class="loading" src="/resources/ges/images/loading-2.gif" alt="">
            <p>页面加载中...</p>
        </div>
    </div>
<!--    过渡层 --end -->

<script>
    // 页面加载过度层。
    (function init(){
        document.onreadystatechange = ()=>{
            if(document.readyState == "complete")
                document.querySelector('#loading').className = "loadingNone";
        }
    })()
</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值