0
我累了創造自舉動畫進度條,就像下面引導動畫進度條
,但我無法得到正確的輸出,我已經加了我的HTML代碼,Javascript代碼&圖像CSS代碼
HTML代碼
<p class="progress-text">html5</p>
<div class="progress"><div class="progress-bar" data-present="95%"></div></div>
<p class="progress-text">css3</p>
<div class="progress"><div class="progress-bar" data-present="90%"></div></div>
CSS代碼
.progress-text{
text-transform: uppercase;
color: #333;
margin-bottom: 5px;
line-height: 18px;
font-size: 12px;
}
.progress{
background-color: transparent;
border-radius: 0;
box-shadow: none;
height: 3px;
margin-bottom: 15px;
overflow: visible;
}
.progress:last-child{
margin-bottom: 0;
}
.progress .progress-bar{
background: #3f51b5;
background: transparent -webkit-linear-gradient(left, #3f51b5, #ff4081);
background: transparent linear-gradient(to right, #3f51b5, #ff4081);
position: relative;
-webkit-transition: all 1.5s ease 0.3s;
transition: all 1.5s ease 0.3s;
color: inherit;
opacity: 0;
}
.progress .progress-bar:before{
position: absolute;
right: 0;
content: attr(data-present);
top: -24px;
color: inherit;
}
的Java Script代碼
(function ($) {
"use strict";
var $progressBar = $('.progress-bar');
$progressBar.appear(function() {
$progressBar.each(function(){
var $progressBarWidth = $(this).data('present');
$(this).css({'width': $progressBarWidth, 'opacity': '1', });
});
});
})(jQuery);
引導版本3.3.7
jQuery的版本 1.12.0
刪除'$ progressBar.appear(函數(){})'這個函數調用,它會工作... [小提琴](https://開頭的jsfiddle .net/1aug3w2j /) –
感謝此代碼工作正常 – muthukrishnan91