Skip to content

Instantly share code, notes, and snippets.

@gregogalante
Last active February 12, 2016 13:15
Show Gist options
  • Save gregogalante/fd2f2f1d32ec4a6a8775 to your computer and use it in GitHub Desktop.
Save gregogalante/fd2f2f1d32ec4a6a8775 to your computer and use it in GitHub Desktop.
Animazione di sviluppo numeri di un contatore numerico.
var animateCounters = function(duration) {
var $count = $('.counter');
if($count.length) {
$count.each(function () {
$(this).prop('Counter',0).animate({
Counter: $(this).attr('count-number')
}, {
duration: duration,
easing: 'swing',
step: function (now) {
$(this).text(Math.ceil(now));
}
});
});
}
};
// How to use it:
// Add class="counter" and data-count=":value" to element
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment