Permalink
Browse files

fixed flickering on centered text on multiple trigger

  • Loading branch information...
1 parent 35428eb commit a2094f8b4e13894b2ebc96bef84e4fe343eafdf8 @minddust committed Jun 27, 2012
Showing with 9 additions and 10 deletions.
  1. +7 −8 bootstrap-progressbar.js
  2. +2 −2 bootstrap-progressbar.min.js
View
@@ -1,5 +1,5 @@
/* ========================================================
- * bootstrap-progressbar v0.4.5
+ * bootstrap-progressbar v0.4.6
* ========================================================
* Copyright 2012 minddust.com
*
@@ -28,6 +28,8 @@
transition: function() {
var $this = this.element,
$parent = $this.parent(),
+ $back = this.back,
+ $front = this.front,
options = this.options,
percentage = $this.attr('data-percentage'),
amount_part = $this.attr('data-amount-part'),
@@ -54,7 +56,7 @@
}
}
- if (options.display_text === $.fn.progressbar.display_text.center) {
+ if (options.display_text === $.fn.progressbar.display_text.center && !$front && !$back) {
$parent.css('position', 'relative');
$this.css({
'position': 'absolute',
@@ -65,13 +67,10 @@
'border-radius': options.border_radius
});
- $parent.find('.progressbar-front-text').remove();
- $parent.find('.progressbar-back-text').remove();
-
$parent.prepend('<span class="progressbar-back-text" style="position:absolute;width:100%;text-align:center"></span>');
$this.prepend('<span class="progressbar-front-text" style="display:block;text-align:center"></span>');
- var $back = $parent.find('.progressbar-back-text'),
- $front = $parent.find('.progressbar-front-text');
+ this.back = $back = $parent.find('.progressbar-back-text'),
+ this.front = $front = $parent.find('.progressbar-front-text');
$front.css('width', $parent.css('width'));
$(window).resize(function() {
$front.css('width', $parent.css('width'));
@@ -107,8 +106,8 @@
$this.text(text);
}
else if (options.display_text === $.fn.progressbar.display_text.center) {
- $front.text(text);
$back.text(text);
+ $front.text(text);
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit a2094f8

Please sign in to comment.