http://jsfiddle.net/2gsNy/1/進步增加值不會與工作百分比以及
我想使它+10,爲第一,但第二和增加它的方式比10後的工作..
我的js
$('#test').on('click', function (e) {
$this = $('#progressbarr > div').width();
var i = $this + 10;
$('#progressbarr > div').css('width', (i + '%'));
$progress_bar = $('#progressbarr');
var progressbar_width = Math.floor(100 * ($progress_bar.find('div').width())/$progress_bar.width());
$progress_bar.find('span').text(progressbar_width + '%');
});
解決 $此= Math.floor(100 *($( '#progressbarr> DIV')。寬度()/ $('#progressbarr')。width())); var i = $ this + 10; $('#progressbarr> div')。css('width',(i +'%')); thx –