jquery實現(xiàn)百分比記分進度條
本文實例為大家分享了jquery實現(xiàn)百分比記分進度條的具體代碼,供大家參考,具體內(nèi)容如下
1.先看效果

2.代碼如下

jquery.lineProgressbar.js代碼如下
(function($){
'use strict';
$.fn.LineProgressbar = function(options){
var options = $.extend({
percentage : null,
ShowProgressCount: true,
duration: 1000,
// Styling Options
fillBackgroundColor: '#3498db',
backgroundColor: '#EEEEEE',
radius: '0px',
height: '10px',
width: '100%'
},options);
return this.each(function(index, el) {
// Markup
$(el).html('<div class="progressbar"><div class="proggress"></div></div><div class="percentCount"></div>');
var progressFill = $(el).find('.proggress');
var progressBar= $(el).find('.progressbar');
progressFill.css({
backgroundColor : options.fillBackgroundColor,
height : options.height,
borderRadius: options.radius
});
progressBar.css({
width : options.width,
backgroundColor : options.backgroundColor,
borderRadius: options.radius
});
// Progressing
progressFill.animate(
{
width: options.percentage + "%"
},
{
step: function(x) {
if(options.ShowProgressCount){
$(el).find(".percentCount").text("("+Math.round(x) + "分"+")");
}
},
duration: options.duration
}
);
});
}
})(jQuery);
jquery.lineProgressbar.css樣式代碼如下
#progressbar1{
display: flex;
height: 15px;
}
.progressbar {
width: 50%;
margin-top: 5px;
position: relative;
background: #182746 !important;
border-radius: 6px !important;
box-shadow: inset 0px 1px 1px rgba(0,0,0,.1);
}
.proggress{
height: 8px;
width: 10px;
background: linear-gradient(to right, rgb(13, 93, 176), rgb(32, 177, 223)) !important;
border-radius: 6px !important;
}
.percentCount{
white-space: nowrap;
margin-left: 10px;
font-size: 14px;
}
這樣就可以實現(xiàn)記分條,百分比的話只需要將分改成%就OK了。
直接用!??!
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
jQuery遮罩層實現(xiàn)方法實例詳解(附遮罩層插件)
這篇文章主要介紹了jQuery遮罩層實現(xiàn)方法,結(jié)合實例形式較為詳細的分析了jQuery遮罩層樣式及功能實現(xiàn)技巧,并附帶分析了一個簡單jQuery遮罩層插件實現(xiàn)方法,需要的朋友可以參考下2015-12-12
基于jQuery實現(xiàn)圖片推拉門動畫效果的兩種方法
本文給大家分享兩種方法實現(xiàn)''推拉門''動畫效果也可以稱作是手風(fēng)琴效果,具體實現(xiàn)方法大家通過本文一起學(xué)習(xí)吧2017-08-08
jQuery實現(xiàn)的簡單折疊菜單(折疊面板)效果代碼
這篇文章主要介紹了jQuery實現(xiàn)的簡單折疊菜單(折疊面板)效果代碼,涉及jQuery中slideToggle與toggleClass方法的靈活使用技巧,需要的朋友可以參考下2015-09-09
jquery+css實現(xiàn)絢麗的橫向二級下拉菜單-附源碼下載
這篇文章主要介紹了jquery+css實現(xiàn)絢麗的橫向二級下拉菜單-附源碼下載,需要的朋友可以參考下2015-08-08
jQuery彈出層始終垂直居中相對于屏幕或當(dāng)前窗口
碰到?jīng)]有固定高或者固定寬或者固定高和寬的時候,我們就需要用JS去處理,去動態(tài)獲取當(dāng)前窗口高或者寬;今天弄了2種情況,一個是相對于屏幕窗體,一個是相對于當(dāng)前的窗口,看代碼2013-04-04
sliderToggle在寫jquery的計時器setTimeouter中不生效
sliderToggle在setTimeouter中不生效,還報錯說是發(fā)生了意想不到的錯誤2014-05-05
jquery ajaxfileupload異步上傳插件使用詳解
這篇文章主要為大家詳細介紹了jquery ajaxfileupload異步上傳插件的使用,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-02-02

