纯CSS和jQuery实现的在页面顶部显示的进度条效果2例(仿手机浏览器进度条效果)_ Div+Css教程-查字典教程网
纯CSS和jQuery实现的在页面顶部显示的进度条效果2例(仿手机浏览器进度条效果)
纯CSS和jQuery实现的在页面顶部显示的进度条效果2例(仿手机浏览器进度条效果)
发布时间:2016-12-27 来源:查字典编辑
摘要:一、纯CSS实现昨天在网上闲逛时,看到一个博客的页面最顶部有一个进度条特效,感觉挺好的,就分析了一下代码,找出了其中的关键部份,使用纯CSS...

一、纯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></p>

二、JQuery实现

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

<title>页面顶部显示的进度条效果</title>

<div id="web_loading"><div></div></div>

<script src="http://www.jb51.netajaxjs/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>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新 Div+Css教程学习
    热门 Div+Css教程学习
    网页设计子分类