I’m trying to rotate a needle on a “speedometer” by looking for each click of a “yes” on a survey, and for each click I would like to rotate the needle by a couple of degrees, but i don’t exaclty know how to get that effects.
This is what I got:
jQuery('input[value="Yes"]').on('click', function (){
jQuery('#progress').animate( marginBottom: +=4 },
{
step: function(now,fx) {
jQuery(this).css('-webkit-transform','rotate('+now+'deg)');
};
});
css:
#progress{
top: 78px;
left: 34px;
height: 0px;
width: 130px;
position: relative;
border: 2px solid #232323;
border-radius: 2px;
-webkit-transform: rotate(7deg);
}
Here’s the Fiddle: http://jsfiddle.net/pTkkS/2/
jsFiddle