当前位置: 移动技术网 > IT编程>网页制作>CSS > 纯CSS和jQuery实现的在页面顶部显示的进度条效果2例(仿手机浏览器进度条效果)

纯CSS和jQuery实现的在页面顶部显示的进度条效果2例(仿手机浏览器进度条效果)

2019年07月25日  | 移动技术网IT编程  | 我要评论
这篇文章主要介绍了纯CSS和jQuery实现的在页面顶部显示的进度条效果2例,仿手机浏览器进度条效果,分别使用纯CSS和jQuery实现,需要的朋友可以参考下... 14-04-16

一、纯css实现

昨天在网上闲逛时,看到一个博客的页面最顶部有一个进度条特效,感觉挺好的,就分析了一下代码,找出了其中的关键部份,使用纯css实现的,给大家分享一下。


复制代码
代码如下:

<style type="text/css">
body{ margin:0; padding:0;}
@-moz-keyframes progressing {
0% {
width:0px;
}
100% {
width:100%;
}
}
@-webkit-keyframes progressing {
0% {
width:0px;
}
100% {
width:100%;
}
}
.progress {
width:100%;
height:5px;
overflow:hidden;
background-color:#27ccc0;
position:fixed;
top:0;
left:0;
z-index:9;
-moz-animation:progressing 2s ease-out;
-webkit-animation:progressing 2s ease-out;
}
</style>
<p class="progress"></p>


二、jquery实现

一个在页面顶部显示的进度条效果,像在智能手机上浏览网页一样,手机上的浏览器进度条一般都在屏幕顶部,一条极细的小线条,当页面加载的时候,它就不断的加载显示进度,本网页进度条特效与此十分相似,基于jquery插件实现的效果。



复制代码
代码如下:

<title>页面顶部显示的进度条效果</title>
<div id="web_loading"><div></div></div>
<script src="/ajaxjs/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">// < ![cdata[
jquery(document).ready(function(){
jquery("#web_loading div").animate({width:"100%"},800,function(){
settimeout(function(){jquery("#web_loading div").fadeout(500);
});
});
});
// ]]></script>
<style>
#web_loading{
z-index:99999;
width:100%;
}
#web_loading div{
width:0;
height:5px;
background:#ff9f15;
}
</style>

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网