diff --git a/src/definitions/modules/progress.js b/src/definitions/modules/progress.js index fa170e24b..bd2fb5c65 100644 --- a/src/definitions/modules/progress.js +++ b/src/definitions/modules/progress.js @@ -185,12 +185,16 @@ $.fn.progress = function(parameters) { total = module.total || 0, percent = (module.is.visible() && animating) ? module.get.displayPercent() - : module.percent || 0 + : module.percent || 0, + left = (module.total > 0) + ? (total - value) + : (100 - percent) ; templateText = templateText || ''; templateText = templateText .replace('{value}', value) .replace('{total}', total) + .replace('{left}', left) .replace('{percent}', percent) ; module.debug('Adding variables to progress bar text', templateText); @@ -379,20 +383,23 @@ $.fn.progress = function(parameters) { settings.onChange.call(element, percent, module.value, module.total); }, labelInterval: function() { - clearInterval(module.interval); - $bar - .one(transitionEnd + eventNamespace, function() { + var + animationCallback = function() { module.verbose('Bar finished animating, removing continuous label updates'); clearInterval(module.interval); animating = false; module.set.labels(); - }) + } ; + clearInterval(module.interval); + $bar.one(transitionEnd + eventNamespace, animationCallback); + module.timer = setTimeout(animationCallback, settings.duration + 100); animating = true; module.interval = setInterval(module.set.labels, settings.framerate); }, labels: function() { module.verbose('Setting both bar progress and outer label text'); + console.log('updating'); module.set.barLabel(); module.set.state(); },