I’ve found this nice animating progress bar tutorial:
http://www.cssflow.com/snippets/animated-progress-bar/demo
However the progress bar doesn’t use jquery and the tutorial doesn’t tell you how to link multiple buttons to the progressbar. So after searching I found this tutorial:
http://www.jcode.ninja/id/8561710
I’ve simply used the code in the tutorial above for now just to see if i can get it working.
My question is how do you animate the progress in the same way as the first tutorial? Is it possible to apply a gradient starting with green then fading to orange then fading into red. I can do this in photoshop, which isnt a problem but can you add it as a progressbar “skin” rather than the default grey?
Thanks in advance
5
Answers
You could use css3 transitions and changing background color. You set the transition and then, by just changing the background color, the animation performs. Check this fiddle: http://jsfiddle.net/en2cb2vq/
CSS Code:
HTML Code:
Javascript (with jQuery):
this will be duplicate question already asked question, try to search and achieve it, don’t ask question like this, if having error in code means u can post the issue,
http://stackoverflow.com/questions/5047498/how-do-you-animate-the-value-for-a-jquery-ui-progressbar
You can animate the bar using CSS
Transition
of.ui-progressbar-value
.Take care:
Transition
isn’t Cross Browser.References: http://www.w3schools.com/css/css3_transitions.asp
A WORKING EXAMPLE:
http://jsfiddle.net/y2mg8ejk/
IE8/9 fallbacks
with old Browser you can use and other approch. jQuery UI has
color animation
inside his surce code:I change my Fiddle to use jquery instead transition:
Take a look: http://jsfiddle.net/y2mg8ejk/2/
jQuery UI – Color Animation [doc]: http://jqueryui.com/animate/
You can use this with old browser and the
transition
with other.I used the first tutorial and created a JSfiddle of that:
https://jsfiddle.net/LgfcwxLu/
What you should do is add to the .progress css the gradient:
You can create the gradient with this tool:
http://www.colorzilla.com/gradient-editor/
Let me know if that helps you?
You can simply apply the styles from the colored progress-bar onto the jQuery UI progress-bar, including the stripes. In the following jsfiddle I took the essential css and changed the
.progress-bar
class name in the stylesheet to.ui-progressbar-value
. To change the color, just change it with jQuery inline or add classes for each color and switch the class with jQuery.See the fiddle. It is not perfect but it will give you an idea.