純CSS和jQuery實現的在頁面頂部顯示的進度條效果
一、純CSS實現
昨天在網上閒逛時,看到一個博客的頁面最頂部有一個進度條特效,感覺挺好的,就分析了一下代碼,找出了其中的.關鍵部份,使用純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;
}
二、JQuery實現
一個在頁面頂部顯示的進度條效果,像在智能手機上瀏覽網頁一樣,手機上的瀏覽器進度條一般都在屏幕頂部,一條極細的小線條,當頁面加載的時候,它就不斷的加載顯示進度,本網頁進度條特效與此十分相似,基於jquery插件實現的效果。
#web_loading{
z-index:99999;
width:100%;
}
#web_loading div{
width:0;
height:5px;
background:#FF9F15;
}