纯CSS3撰写的的精致动漫进度条(无flash/无图象/无

日期:2021-03-10 类型:科技新闻 

关键词:抠图换背景,免费的抠图软件,美图抠图,手机抠图软件哪个好,p图软件哪个好用

载入动漫和进度条的真实目地是让客户掌握每日任务的进度,有许多的根据JavaScript的动漫,但我决策切换到CSS3。 在本实例教程中,我决策制做动漫的进度条,应用纯CSS:沒有flash,沒有图象,沒有脚本制作。另外,我潜心于找寻最简易的方法保证这1点。这里的事例:
 

HTML标识
大家必须的是这两个div,第1个div将意味着主器皿和圆角和黑影实际效果,第2个div的具体进度条。 我加上了1个键入和1个按钮操纵和播发进度条。

拷贝编码
编码以下:

<div id="prbar">
<div id="prpos">
</div>
</div>
<input id="moveTo" value="57" style="width:30px;" />%
<button onclick="MoveTo();return false;">Move</button>

The CSS :

拷贝编码
编码以下:

#prbar {
margin:5px;
width:500px;
background-color:#dddddd;
overflow:hidden;
/* 边框实际效果 */
border: 1px solid #bbbbbb;
-moz-border-radius: 15px;
border-radius: 15px;
/* 为进度条提升黑影实际效果 */
-webkit-box-shadow: 0px 2px 4px #555555;
-moz-box-shadow: 0px 2px 4px #555555;
box-shadow: 0px 2px 4px #555555;
}
/* No rounded corners for Opera, because the overflow:hidden dont work with rounded corners */
doesnotexist:-o-prefocus, #prbar {
border-radius:0px;
}
#prpos {
width:0%;
height:30px;
background-color:#3399ff;
border-right:1px solid #bbbbbb;
/* CSS3 进度条渐变色 */
transition: width 2s ease;
-webkit-transition: width 0s ease;
-o-transition: width 0s ease;
-moz-transition: width 0s ease;
-ms-transition: width 0s ease;
/* CSS3 Stripes */
background-image: linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%);
background-image: -moz-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%);
background-image: -ms-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%);
background-image: -o-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%);
background-image: -webkit-gradient(linear, 100% 100%, 0 0,color-stop(.25, #99ccff), color-stop(.25, #3399ff),color-stop(.5, #3399ff),color-stop(.5, #99ccff),color-stop(.75, #99ccff),color-stop(.75, #3399ff),color-stop(1, #3399ff));
background-image: -webkit-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%);
background-size: 40px 40px;
/* Background stripes animation */
animation: bganim 3s linear 2s infinite;
-moz-animation: bganim 3s linear 2s infinite;
-webkit-animation: bganim 3s linear 2s infinite;
-o-animation: bganim 3s linear 2s infinite;
-ms-animation: bganim 3s linear 2s infinite;
}
@keyframes bganim {
from {background-position:0px;} to { background-position:40px;}
}
@-moz-keyframes bganim {
from {background-position:0px;} to { background-position:40px;}
}
@-webkit-keyframes bganim {
from {background-position:0px;} to { background-position:40px;}
}
@-o-keyframes bganim {
from {background-position:0px;} to { background-position:40px;}
}
@-ms-keyframes bganim {
from {background-position:0px;} to { background-position:40px;}
}

进度条的宽度和高宽比的必须只能特定1次,特定的宽度在“prbar”和高宽比在“prpos”内。
您能够改动成任何你要想的情况条纹或任何纹路比如应用线形渐变色,你能够画,线,圆
The Animation :
大家的进度条的动漫,大家只必须设定此外1个div的宽度,最简易的方式自然是立即特定百分比测算的宽度。
小的JavaScript涵数将载入的键入值,并设定宽度为动漫的进度条

拷贝编码
编码以下:

function MoveTo() {
var prpos = document.getElementById('prpos');
prpos.style.width = document.getElementById('moveTo').value + "%";
}

源代码免费下载详细地址
原文 http://www.cnblogs.com/58top/archive/2013/01/07/pure_css_progress_bar_animated_by_css3.html