I need to \"animate\" a variable with jquery.
Example: The variable value is 1. The value should be 10 after 5 seconds. It should be increase \"smoothl
As addition to Ties answer - you dont event need to append dummy element to the DOM. I do it like this:
$.fn.animateValueTo = function (value) {
var that = this;
$('')
.css('display', 'none')
.css('letter-spacing', parseInt(that.text()))
.animate({ letterSpacing: value }, {
duration: 1000,
step: function (i) {
that.text(parseInt(i));
}
});
return this;
};