首页 > 代码库 > 进度条jquery效果

进度条jquery效果

1.

/*
jQuery.loanPlanNum = function(tag,len) {
var $loanPlan = jQuery(tag);
for(var i = 0; i< $loanPlan.length; i++){
var text = $loanPlan.eq(i).text();
var index = text.lastIndexOf("%");
text = text.slice(0,index);
text = parseInt(text,10);
text = Math.floor(text/10);
var numLoan = text * len;
$loanPlan.eq(i).html(text*10+"%");
$loanPlan.eq(i).css({"backgroundPositionX": -numLoan + "px"});
}
};
jQuery.loanPlanNum(".bidProgress","277");
*/

2.


(function($) {
$.fn.progressBar = function(options) {
var opts = $.extend(true, {},
$.fn.progressBar.defaults, options);
return this.each(function() {
var $this = $(this);
var text = $this.text(),
index = text.lastIndexOf("%"),
numLoan;
text = text.slice(0,index);
text = parseInt(text,10);
text = Math.floor(text/10);
numLoan =text*opts.barLength;
$this.html(text*10+"%");
$this.css({"backgroundPositionX": -numLoan + "px"});
});
};
$.fn.progressBar.defaults = {
barLength:230
};
})(jQuery);

 

进度条jquery效果