Last active
February 12, 2016 13:15
-
-
Save gregogalante/fd2f2f1d32ec4a6a8775 to your computer and use it in GitHub Desktop.
Animazione di sviluppo numeri di un contatore numerico.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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