新聞中心
之前為大家分享過一篇關于css3進度條的一篇文章《實現(xiàn)CSS3動態(tài)進度條及JQUERY百分比數(shù)字顯示》,今天為大家?guī)砹硪豢罡邆€性化的進度條:CSS3閃爍跳躍的進度條。

創(chuàng)新互聯(lián)主要從事網(wǎng)站設計制作、成都做網(wǎng)站、網(wǎng)頁設計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務。立足成都服務甘泉,十多年網(wǎng)站建設經(jīng)驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:028-86922220
查看預覽 下載附件
這個示例的原理和以前的都是一樣的,都是通過大量的css3屬性來實現(xiàn)的,如:animation、transform、keyframes等等屬性。值得注意的是這個示例采用了結構性偽類選擇符E:nth-child(n),來進行對HTML元素的選擇以及控制輸出。相信這個偽類選擇符在將來會是一個很強大的一個工具。推薦大家多多了解以及實踐使用。
這個偽類選擇符E:nth-child(n)的含義是匹配父元素的第n個子元素E。 例如:ul li:nth-child(3)表示的是選擇
- 元素里面的第3個
- 。提示一下,該屬性在IE8(包含IE8)版本以下是不支持的。下面就一起來看看該示例的實現(xiàn)代碼吧,完整的代碼可下載附件查看。
HTML結構代碼
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-),否則將不能正常顯示效果。
原文鏈接:http://www.jiawin.com/flashing-jumping-progress-bar/
本文題目:CSS3閃爍跳躍的進度條
瀏覽路徑:http://m.fisionsoft.com.cn/article/ccojjps.html


咨詢
建站咨詢
