<
首页 emlog教程 正文
  • 本文约2810字,阅读需14分钟
  • 1091
  • 0

EMLOG添加页面加载(加载中)特效的方法

摘要

相信大家都注意过不管是APP上还是大型网站上都有加载中的提示,这样可以有效提升访客体验,让访客不会觉得页面加载的过程是乏味的,那么现在就来为大家分享一些EMLOG添加页面加载(加载中)特效的方法。

相信大家都注意过不管是APP上还是大型网站上都有加载中的提示,这样可以有效提升访客体验,让访客不会觉得页面加载的过程是乏味的,那么现在就来为大家分享一些EMLOG添加页面加载(加载中)特效的方法。

一、EMLOG左下角添加加载中提示特效

1、打开模板文件footer.php,在</body>标签前添加如下代码

<div id="circle"></div>
<div id="circletext"></div>
<div id="circle1"></div>

2、在上面的这段代码下面继续添加如下代码

<script type="text/javascript">
$(function () {
$("#circletext").text("加载中");
    $(window).load(function() {
        $("#circle").fadeOut(400);
        $("#circle1").fadeOut(600);
        $("#circletext").text("完成鸟").fadeOut(800);
    });
});
//-->
</script>

3、打开模板样式文件style.css,在合适的位置添加如下代码

/* 圆圈加载特效*/
#circle{background-color:rgba(0,0,0,0);border:5px solid rgba(10,10,10,0.9);opacity:.9;border-right:5px solid rgba
(0,0,0,0);border-left:5px solid rgba(0,0,0,0);border-radius:50px;box-shadow:0 0 35px #808080;width:60px;height:60px;margin:0 auto;position:fixed;left:30px;bottom:30px;-moz-animation:spinPulse 1s infinite linear;-webkit-animation:spinPulse 1s infinite linear;-o-animation:spinPulse 1s infinite linear;-ms-animation:spinPulse 1s infinite linear;}
#circle1{background-color:rgba(0,0,0,0);border:6px solid rgba(20,20,20,0.9);opacity:.9;border-left:6px solid rgba(0,0,0,0);border-right:6px solid rgba(0,0,0,0);border-radius:50px;box-shadow:0 0 15px #202020;width:40px;height:40px;margin:0 auto;position:fixed;left:39px;bottom:39px;-moz-animation:spinoffPulse 1s infinite linear;-webkit-animation:spinoffPulse 1s infinite linear;-o-animation:spinoffPulse 1s infinite linear;-ms-animation:spinoffPulse 1s infinite linear;}
#circletext{width:46px;height:20px;margin:0 auto;position:fixed;left:46px;bottom:53px;}
@-moz-keyframes spinPulse{0%{-moz-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050;}50%{-moz-transform:rotate(145deg);opacity:1;}100%{-moz-transform:rotate(-320deg);opacity:0;}}
@-moz-keyframes spinoffPulse{0%{-moz-transform:rotate(0deg);}100%{-moz-transform:rotate(360deg);}}
@-webkit-keyframes spinPulse{0%{-webkit-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050;}50%{-webkit-transform:rotate(145deg);opacity:1;}100%{-webkit-transform:rotate(-320deg);opacity:0;}}
@-webkit-keyframes spinoffPulse{0%{-webkit-transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);}}
@-o-keyframes spinPulse{0%{-o-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050;}50%{-o-transform:rotate(145deg);opacity:1;}100%{-o-transform:rotate(-320deg);opacity:0;}}
@-o-keyframes spinoffPulse{0%{-o-transform:rotate(0deg);}100%{-o-transform:rotate(360deg);}}
@-ms-keyframes spinPulse{0%{-ms-transform:rotate(160deg);opacity:0;box-shadow:0 0 1px #505050;}50%{-ms-transform:rotate(145deg);opacity:1;}100%{-ms-transform:rotate(-320deg);opacity:0;}}
@-ms-keyframes spinoffPulse{0%{-ms-transform:rotate(0deg);}100%{-ms-transform:rotate(360deg);}}

4、打开网站首页,点击查看效果

二、在网站整体页面上添加加载遮挡层特效

1、打开模板文件header.php,在合适的位置添加如下加载jquery代码

<script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.7.1/jquery.min.js"></script>

2、继续在模板文件header.php上的</head>前添加下面的这段JS代码

<script type="text/javascript">
jQuery(function(){
jQuery('#loading-one').empty().append('页面加载完毕.').parent().fadeOut('slow');
});</script>

3、继续在模板文件header.php上的<body>后添加如下效果样式

<div id="loading" style="position:fixed !important;position:absolute;top:0;left:0;height:100%; width:100%; z-index:999; background:#000; opacity:0.6; filter:alpha(opacity=60);font-size:14px;line-height:20px;" onclick="javascript:turnoff('loading')">
<p id="loading-one" style="color:#fff;position:absolute; top:50%; left:50%; margin:50px 0 0 -50px; padding:3px 10px;" onclick="javascript:turnoff('loading')">页面载入中,请稍后...</p>
</div>

4、打开网站首页,点击查看效果

三、注意事项

1、本教程中分享了两种EMLOG添加页面加载(加载中)特效的方法,第一种是在左下角添加加载特效,第二种则是全局添加,请自行选择

标签:emlog教程
评论
更换验证码
友情链接