一直以来都想要在博客下边加入加载中代码,但是由于主题的导航栏有了遮盖就一直没有使用,今天把原作者的代码略做了一些修改,给网站安装了,分享给大家。代码默认为左下角,如果需要右下角则替换“left”为“right”,“right”为“left”就可以了!

这个特效叫“圆圈加载”,需要加载jQuery。
首先我们在header.php中引入jQuery库
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.min.js">\x3C/script>')</script>
这里我使用的是百度cdn的1.7.2版本的jQuery库,其他jQuery库:
谷歌:<script type="text/javascript" src="http://ajax.useso.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 新浪:<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script> 微软:<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script> 又拍云:<script type="text/javascript" src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-1.7.2.min.js"></script>
然后在footer.php</body>标签前加上:
<div id="circle"></div> <div id="circletext"></div> <div id="circle1"></div>
和
<script type="text/javascript"> jQuery(document).ready(function(){ $("#circletext").text("加载肿"); $(window).load(function() { $("#circle").fadeOut(400); $("#circle1").fadeOut(600); $("#circletext").text("完成鸟").fadeOut(800); }); }); </script>
也可以将上面这段js直接写入您的js文件里。
最后在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);}}
如果你不喜欢中间那段文字,请删掉:
<div id="circletext"></div>
$("#circletext").text("加载肿");
$("#circletext").text("完成鸟").fadeOut(800);
#circletext{width:46px;height:20px;margin:0 auto;position:fixed;left:46px;bottom:53px;}
效果见本站右下角~
775514 524076I just now discovered your blog post and now Im remember to start with followers. 353610
2018年8月18日 07:50756959 154881You seem to be very specialist in the way you write.::~ 381789
2018年8月14日 11:49很乱的样式,是不是没加载?
2016年11月1日 14:01嗯,静态储存炸了
2016年11月13日 09:25这个早就加了,现在用的是加载进度条+淡入淡出
2015年1月30日 19:02淡入淡出感觉太慢了
2015年1月30日 19:25…….不是,是整个页面加载完了再显示
2015年1月30日 23:15就是顶部出来了,看着内容出来很烦
2015年1月30日 23:16这个代码 镇有点意思啊
2014年12月26日 11:10怎么了?这个主题博客里有分享
2014年8月25日 14:08有空偶也学习下,不知道asp的能否增加……
2014年8月25日 01:58可以的,这个又不是用php语言编写的js和html而与
2014年8月25日 12:26