为DUX主题添加加载中特效
admin
2020-12-01
26
0
为DUX主题添加加载中特效

首先在header.php文件<body>标签下面添加如下代码:

<div class="loading">
    <div class="loading1">
	    <div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="block"></div>
		<div class="section-left"></div>
		<div class="section-right"></div>
    </div>
</div>

然后把下面的代码保存为load.js放在footer.php文件适当位置。

$(function(){
  setTimeout(function(){
	var load = document.getElementsByClassName('loading')[0];
 

	load.style.display = 'none';
}, 5000);

    $('.loading').css('display' , 'none');

		
});

把以下css代码保存为load.css放在header.php文件适当位置就可以了。

.loading {
    height: 100%;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    background-color: rgba(250,250,250,.1);
}
.loading, .loading1 {
    display: true;
}
  .loading1 {
     
    display: block;
    position: relative;
    left: 50%;
    top: 50%;
    width: 150px;
    height: 150px;
    margin: -75px 0 0 -75px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #3498db;
    -webkit-animation: spin 2s linear infinite;
    animation: spin 2s linear infinite;
    z-index: 1001;
        animation-name: clockwise;
    animation-duration:1s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: normal;

    /*safari & Chrome */
    -webkit-animation-name:clockwise;
    -webkit-animation-duration:1s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: normal;
}
.loading .block:nth-child(1) {
    /* animation-name: anticlockwise; */
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #e74c3c;
    -webkit-animation: spin 3s linear infinite;
    animation: spin 3s linear infinite;
    animation-name: anticlockwise;
    animation-duration: 1s;
    /* animation-timing-function: linear; */
    /* animation-iteration-count: infinite; */
    /* animation-direction: normal; */
    /* -webkit-animation-name: anticlockwise; */
    /* -webkit-animation-duration: 1s; */
    /* -webkit-animation-timing-function: linear; */
    /* -webkit-animation-iteration-count: infinite; */
    /* -webkit-animation-direction: normal; */
}
.block, .frame, .temp {
    padding: 0;
    margin: 0;
    background: 0 0;
    border: none;
}
    .loading .block:nth-child(2) {
    content: "";
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #f9c922;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
          animation-name: clockwise;
    animation-duration:1s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: normal;

    /*safari & Chrome */
    -webkit-animation-name:clockwise;
    -webkit-animation-duration:3s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: normal;
}
.block, .frame, .temp {
    padding: 0;
    margin: 0;
    background: 0 0;
    border: none;
}
    .loading .block:nth-child(3) {
    -webkit-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    transform: translateX(-100%);
    -webkit-transition: all .7s .3s cubic-bezier(.645, .045, .355, 1);
    transition: all .7s .3s cubic-bezier(.645, .045, .355, 1);
}
.block, .frame, .temp {
    padding: 0;
    margin: 0;
    background: 0 0;
    border: none;
}
    .loading .block:nth-child(4) {
    -webkit-transform: translateX(100%);
    -ms-transform: translateX(100%);
    transform: translateX(100%);
    -webkit-transition: all .7s .3s cubic-bezier(.645, .045, .355, 1);
    transition: all .7s .3s cubic-bezier(.645, .045, .355, 1);
}

.block, .frame, .temp {
    padding: 0;
    margin: 0;
    background: 0 0;
    border: none;
}

.block, .frame, .temp {
    padding: 0;
    margin: 0;
    background: 0 0;
    border: none;
}
    
@media (max-width: 640px){
.loading1 {
    display: block;
    position: relative;
    left: 60%;
    top: 57%;
    width: 80px;
    height: 80px;
    margin: -75px 0 0 -75px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #3498db;
    -webkit-animation: spin 2s linear infinite;
    animation: spin 2s linear infinite;
    z-index: 1001;
    animation-name: clockwise;
    animation-duration: 1s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-direction: normal;
    -webkit-animation-name: clockwise;
    -webkit-animation-duration: 1s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: normal;
}
}

@keyframes clockwise{
    from {
        -webkit-transform:rotate(0deg);
        -moz-transform:rotate(0deg);
        -ms-transform: rotate(0deg);
        -o-transform: rotate(0deg);
    }
    to {
        -webkit-transform:rotate(360deg);
        -moz-transform:rotate(360deg);
        -ms-transform: rotate(360deg);
        -o-transform: rotate(360deg);
    }
}

@-webkit-keyframes clockwise{
    from {
        -webkit-transform:rotate(0deg);
    }
    to {
        -webkit-transform:rotate(360deg);
    }
}

@keyframes anticlockwise{
    from {
        -webkit-transform:rotate(0deg);
        -moz-transform:rotate(0deg);
        -ms-transform: rotate(0deg);
        -o-transform: rotate(0deg);
    }
    to {
        -webkit-transform:rotate(-360deg);
        -moz-transform:rotate(-360deg);
        -ms-transform: rotate(-360deg);
        -o-transform: rotate(-360deg);
    }
}

@-webkit-keyframes anticlockwise{
    from {
        -webkit-transform:rotate(0deg);
    }
    to {
        -webkit-transform:rotate(-360deg);
    }
}
打赏
WordPress优化技巧用代码实现自动为文章添加标签
上一篇
WordPress如何禁止古腾堡编辑器加载谷歌字体
下一篇

发表评论

admin
0 文章
0 评论
0 喜欢
标签
#WordPress #b2主题美化 #wordpress主题 #zblog #b2主题 #主题美化 #wordpress函数 #WordPress博客主题 #dux主题 #模块化 #上传图片 #数据库 #酱茄Free主题 #WordPress 4.6 #加载中 #浏览文章 #B2主题修改 #WordPress更新 #大媒体主题 #菜单美化 #niRvana主题 #主题修改 #整站变灰 #链接别名 #浏览次数 #wordpress简洁主题 #大数据 #蜀犬吠日 #php #新窗口 #阅读时间 #wordpress代码 #匈奴 #用户中心 #B2美化 #wordpress5.7.1 #认证图标 #PHP代码 #乌合之众 #新闻资讯 #附件页面 #半老徐娘 #用户昵称 #begin主题 #wp插件 #宋玉 #评论框修改 #php内存限制 #暴虎冯河 #博客主题 #电影下载 #debug #语言选择器 #REST API #企业主题 #标签内链 #隐藏浏览量 #wordpress后台 #去除wordpresslogo #登陆访问 #zblog验证码 #小工具区块 #rouse主题 #隐藏登陆地址 #wordpress回收站 #古腾堡编辑器 #皮里阳秋 #zblogphp #影视主题 #谷歌字体 #ue编辑器 #作者筛选 #霍去病 #wordpress多域名 #响应式 #站点健康 #成语大全 #轻拟物 #免费主题 #沅芷澧兰 #wordpress开发 #域名绑定 #等级图标 #js #一意孤行 #投稿 #轻拟物主题 #wirdpress资讯主题 #内存溢出 #注销账户 #高雅 #wordpress技巧 #联系页面 #js特效 #一言 #搬家技巧 #邀请码 #函数 #流量 #wordpress技术 #多风格 #自适应 #logo图标 #动态网页 #子目录 #以父之名 #随机缩略图 #导航栏 #调试模式 #伪静态 #html5 #正则表达式 #http #WebSocket #静态网页 #复古风
生成中...
扫描二维码
扫描二维码