Closed visitsb closed 10 years ago
hi @visitsb,
agree - it's a nice to have. but i have to mention that there's always a workaround.
e.g instead of:
$(document).ready(function() {
$('.progress .bar').progressbar({
update: function(percent, $this) {
$this.parent().css('background-color', 'rgb(' + Math.round(current_percentage / 100 * 255) + ', 0, 0)');
}
});
});
you could do something like this:
$(document).ready(function() {
$('.progress .bar').each(function () {
var $pb = $(this);
$pb.progressbar({
update: function(percent) {
$pb.parent().css('background-color', 'rgb(' + Math.round(current_percentage / 100 * 255) + ', 0, 0)');
}
});
});
});
nonetheless it won't brick anything and it's definitely improving the usability so will will integrate it in the next release.
thanks!
forgot to merge =)
btw. done
will receive $this too.
@minddust Thanks!
there's also a new demo using $this:
http://www.minddust.com/project/bootstrap-progressbar/demo/bootstrap-3-1-1/#m-callback-this
The update callback should have a
$this
context, or argument passed so it is easier to use it to traverse, and find another element to which _currentpercentage can be displayed. This could be used when multiple progressbars are used on the same page, each placed in it's logical group.The change is very trivial, plus to avoid breaking any existing users, I chose to add
$this
as a2nd
argument, although personally I'd prefer to pass$this
as thefirst
argument.An example below,