CSS3實(shí)現(xiàn)的閃爍跳躍進(jìn)度條示例(附源碼)
發(fā)布時間:2013-08-19 17:48:19 作者:佚名
我要評論

原理是通過大量的css3屬性來實(shí)現(xiàn)的,如:animation、transform、keyframes等等屬性,示例采用了結(jié)構(gòu)性偽類選擇符E:nth-child(n),來進(jìn)行對HTML元素的選擇以及控制輸出,感興趣的朋友可以了解下
這個示例的原理是通過大量的css3屬性來實(shí)現(xiàn)的,如:animation、transform、keyframes等等屬性。值得注意的是這個示例采用了結(jié)構(gòu)性偽類選擇符E:nth-child(n),來進(jìn)行對HTML元素的選擇以及控制輸出。相信這個偽類選擇符在將來會是一個很強(qiáng)大的一個工具。推薦大家多多了解以及實(shí)踐使用。這個偽類選擇符E:nth-child(n)的含義是匹配父元素的第n個子元素E。 例如:ul li:nth-child(3)表示的是選擇<ul>元素里面的第3個<li>。提示一下,該屬性在IE8(包含IE8)版本以下是不支持的。
建議開發(fā)童鞋使用跨平臺開發(fā)工具——統(tǒng)一開發(fā)環(huán)境UDE來進(jìn)行查看、調(diào)試、開發(fā)哦~~它是一款HTML5跨平臺一站式應(yīng)用開發(fā)、調(diào)試和部署工具, 支持HTML5跨平臺開發(fā),原Java跨平臺插件支持Android/Symbian/Kjava的跨平臺和原生開發(fā),為開發(fā)者提供豐富的應(yīng)用模板、示例代碼及開發(fā)者社區(qū)服務(wù),已覆蓋Android、iOS、WP、Symbian、Kjava操作系統(tǒng)平臺。
UDE模擬器調(diào)試效果圖:

下面就一起來看看該示例的實(shí)現(xiàn)代碼吧。完整代碼下載請見附件。
HTML結(jié)構(gòu)代碼
<div class="center">
<ul>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
</ul>
</div>
CSS樣式代碼
@keyframes bump {
0% {
opacity: 0;
left: 535px;
}
100% {
left: -10px;
opacity: 0;
}
10%, 85% {
opacity: 1;
}
}
@keyframes spin {
0%, 100% {
height: 20px;
top: 50px;
}
50% {
height: 100px;
top: 0;
}
}
body {
background: rgba(0, 0, 0, 0.2);
}
div.center {
text-align: center;
margin-top: 40px;
}
ul {
background-color: rgba(255, 255, 255, 0.4);
position: relative;
display: block;
padding: 0;
margin: auto;
width: 600px;
height: 10px;
list-style: none;
border-radius: 200px;
border: 5px solid rgba(255, 255, 255, 0.2);
margin-top: 100px;
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
}
ul li {
position: absolute;
margin-top: -55px;
}
ul li:nth-child(1) {
animation: bump 1.5s infinite;
animation-delay: 0.1s;
}
ul li:nth-child(1) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.1s;
background-color: rgba(120, 120, 120, 0.3);
}
ul li:nth-child(2) {
animation: bump 1.5s infinite;
animation-delay: 0.2s;
}
ul li:nth-child(2) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.2s;
background-color: rgba(120, 0, 0, 0.3);
}
ul li:nth-child(3) {
animation: bump 1.5s infinite;
animation-delay: 0.3s;
}
ul li:nth-child(3) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.3s;
background-color: rgba(120, 120, 0, 0.3);
}
ul li:nth-child(4) {
animation: bump 1.5s infinite;
animation-delay: 0.4s;
}
ul li:nth-child(4) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.4s;
background-color: rgba(0, 120, 0, 0.3);
}
ul li:nth-child(5) {
animation: bump 1.5s infinite;
animation-delay: 0.5s;
}
ul li:nth-child(5) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.5s;
background-color: rgba(0, 120, 120, 0.3);
}
ul li:nth-child(6) {
animation: bump 1.5s infinite;
animation-delay: 0.6s;
}
ul li:nth-child(6) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.6s;
background-color: rgba(0, 0, 120, 0.3);
}
ul li:nth-child(7) {
animation: bump 1.5s infinite;
animation-delay: 0.7s;
}
ul li:nth-child(7) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.7s;
background-color: rgba(120, 0, 120, 0.3);
}
注:請自行在所需之處加上瀏覽器前綴(如:-webkit- 、 -moz-),否則將不能正常顯示效果。
源碼下載請見附件
閃爍跳躍進(jìn)度條.rar (1.6 KB)
建議開發(fā)童鞋使用跨平臺開發(fā)工具——統(tǒng)一開發(fā)環(huán)境UDE來進(jìn)行查看、調(diào)試、開發(fā)哦~~它是一款HTML5跨平臺一站式應(yīng)用開發(fā)、調(diào)試和部署工具, 支持HTML5跨平臺開發(fā),原Java跨平臺插件支持Android/Symbian/Kjava的跨平臺和原生開發(fā),為開發(fā)者提供豐富的應(yīng)用模板、示例代碼及開發(fā)者社區(qū)服務(wù),已覆蓋Android、iOS、WP、Symbian、Kjava操作系統(tǒng)平臺。
UDE模擬器調(diào)試效果圖:


下面就一起來看看該示例的實(shí)現(xiàn)代碼吧。完整代碼下載請見附件。
HTML結(jié)構(gòu)代碼
復(fù)制代碼
代碼如下:<div class="center">
<ul>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
</ul>
</div>
CSS樣式代碼
復(fù)制代碼
代碼如下:@keyframes bump {
0% {
opacity: 0;
left: 535px;
}
100% {
left: -10px;
opacity: 0;
}
10%, 85% {
opacity: 1;
}
}
@keyframes spin {
0%, 100% {
height: 20px;
top: 50px;
}
50% {
height: 100px;
top: 0;
}
}
body {
background: rgba(0, 0, 0, 0.2);
}
div.center {
text-align: center;
margin-top: 40px;
}
ul {
background-color: rgba(255, 255, 255, 0.4);
position: relative;
display: block;
padding: 0;
margin: auto;
width: 600px;
height: 10px;
list-style: none;
border-radius: 200px;
border: 5px solid rgba(255, 255, 255, 0.2);
margin-top: 100px;
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
}
ul li {
position: absolute;
margin-top: -55px;
}
ul li:nth-child(1) {
animation: bump 1.5s infinite;
animation-delay: 0.1s;
}
ul li:nth-child(1) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.1s;
background-color: rgba(120, 120, 120, 0.3);
}
ul li:nth-child(2) {
animation: bump 1.5s infinite;
animation-delay: 0.2s;
}
ul li:nth-child(2) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.2s;
background-color: rgba(120, 0, 0, 0.3);
}
ul li:nth-child(3) {
animation: bump 1.5s infinite;
animation-delay: 0.3s;
}
ul li:nth-child(3) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.3s;
background-color: rgba(120, 120, 0, 0.3);
}
ul li:nth-child(4) {
animation: bump 1.5s infinite;
animation-delay: 0.4s;
}
ul li:nth-child(4) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.4s;
background-color: rgba(0, 120, 0, 0.3);
}
ul li:nth-child(5) {
animation: bump 1.5s infinite;
animation-delay: 0.5s;
}
ul li:nth-child(5) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.5s;
background-color: rgba(0, 120, 120, 0.3);
}
ul li:nth-child(6) {
animation: bump 1.5s infinite;
animation-delay: 0.6s;
}
ul li:nth-child(6) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.6s;
background-color: rgba(0, 0, 120, 0.3);
}
ul li:nth-child(7) {
animation: bump 1.5s infinite;
animation-delay: 0.7s;
}
ul li:nth-child(7) div {
border-radius: 22px;
transform-origin: center;
position: absolute;
height: 60px;
width: 80px;
animation: spin 0.4s infinite;
animation-delay: 0.7s;
background-color: rgba(120, 0, 120, 0.3);
}
注:請自行在所需之處加上瀏覽器前綴(如:-webkit- 、 -moz-),否則將不能正常顯示效果。
源碼下載請見附件

閃爍跳躍進(jìn)度條.rar (1.6 KB)
相關(guān)文章
- 這篇文章主要介紹了使用CSS3制作一個簡單的進(jìn)度條(demo)的相關(guān)資料,需要的朋友可以參考下2017-05-23
利用CSS3實(shí)現(xiàn)進(jìn)度條的兩種姿勢詳解
這篇文章主要給大家介紹了利用CSS3實(shí)現(xiàn)進(jìn)度條的兩種姿勢,文中給出了詳細(xì)的示例代碼和圖文介紹,對大家具有一定的參考價值,需要的朋友們下面來一起看看吧。2017-03-21HTML5+CSS3網(wǎng)頁加載進(jìn)度條的實(shí)現(xiàn),下載進(jìn)度條的代碼實(shí)例
本篇文章主要介紹了HTML5+CSS3網(wǎng)頁加載進(jìn)度條的實(shí)現(xiàn),下載進(jìn)度條的代碼實(shí)例,具有一定的參考價值,有興趣的可以了解一下。2016-12-30- 用CSS3的border-radius、box-shadow、transition、-moz-linear-gradient、-webkit-gradient等樣式就可以完成一個時尚進(jìn)度條,這里我們來看幾個CSS3制作彩色進(jìn)度條樣式的代碼2016-06-23
圖解CSS3制作圓環(huán)形進(jìn)度條的實(shí)例教程
圓環(huán)形進(jìn)度條制作的基本思想還是畫出基本的弧線圖形,然后CSS3中我們可以控制其旋轉(zhuǎn)來串聯(lián)基本圖形,制造出部分消失的效果,下面就來帶大家學(xué)習(xí)圖解CSS3制作圓環(huán)形進(jìn)度條的實(shí)2016-05-26html5+css3進(jìn)度條倒計(jì)時動畫特效代碼【推薦】
下面小編就為大家分享一篇html5+css3進(jìn)度條倒計(jì)時動畫特效代碼【推薦】。希望對大家有所幫助。一起跟隨小編過來看看吧2016-03-08可以隨進(jìn)度顯示不同顏色的css3進(jìn)度條分享
這篇文章主要介紹了可以隨進(jìn)度顯示不同顏色的css3進(jìn)度條,文章最后有下載地址,需要的朋友可以參考下2014-04-11css3閃亮進(jìn)度條效果實(shí)現(xiàn)思路及代碼
進(jìn)度條而且還是帶有閃亮,不可思議吧,看下效果圖,至于實(shí)現(xiàn)代碼,感興趣的前端設(shè)計(jì)者可以參考下哈,或許有所意想不到的收獲2013-04-17純CSS3編寫的的精美動畫進(jìn)度條(無flash/無圖像/無腳本/附源碼)
加載動畫和進(jìn)度條的真正目的是讓用戶了解任務(wù)的進(jìn)度,有很多的基于JavaScript的動畫,但我決定切換到CSS3,使用純CSS:沒有flash,沒有圖像,沒有腳本2013-01-07css3制作動態(tài)進(jìn)度條以及附加jQuery百分比數(shù)字顯示
今天就為大家分享一個利用css3制作動態(tài)進(jìn)度條以及附加jQuery百分比數(shù)字顯示,其效果對比flash來說卻毫不遜色,有一個精致的動畫進(jìn)度條,上面還有當(dāng)前進(jìn)度的百分比數(shù)字顯示,2012-12-13