JQUERY
我想根据获得的百分比更改进度条的颜色。我试过像这样将它放在jquery本身中,但是不起作用。
$(el).circleProgress({fill : {color : '<%= colorCode %>'}}).on('circle-animation-progress',function(event,progress,stepValue)
function Circlle(el)
{
$(el).circleProgress().on('circle-animation-progress',stepValue)
{
if(stepValue >= 1)
{
$(this).find('strong').text('100%');
$(this).css('color','forestgreen');
}
else
{
$(this).find('strong').text(String(stepValue.toFixed(2)).substr(2)+'%');
if(stepValue >= 0.8)
$(this).css('color','forestgreen');
else if(stepValue >= 0.6)
$(this).css('color','lightgreen');
else if(stepValue >= 0.4)
$(this).css('color','yellow');
else if(stepValue >= 0.2)
$(this).css('color','orange');
else
$(this).css('color','red');
}
});
};
});
Circlle('.round');
HTML
<div class="round" data-value="<%= pct %>" data-size="100" data-thickness="5">
<strong></strong>
</div>