Reputation: 92591
I have added a label to the jquery ui progressbar using this demo.
What I want to do is change the text color depending on if the progress bar is behind the letter.
How can I tell if that has happened?
Upvotes: 10
Views: 6858
Reputation: 25620
Its kinda ugly but if you duplicate the label, one outside the bar and one inside, and use overflow: hidden
you can pull it off:
Only tested in Chrome dev and firefox 4
Upvotes: 12
Reputation: 21854
if (newVal >= 50)
$('.pblabel').css('color', newColor);
else
$('.pblabel').css('color', defaultColor);
Upvotes: -1
Reputation: 1932
Use the change event
of .progressbar like so:
updateProgressColor = function() {
if( $(this).progressbar('percentage').toFixed(0) == 100 ) {
$(this).css('background', '#F000');
}
}
$('#progressbar').progressbar({
change: updateProgressColor
});
Upvotes: 0