Created
November 23, 2015 15:14
-
-
Save tyxla/b5f4556faa4f2f72f00e to your computer and use it in GitHub Desktop.
incrementNumberAnimation
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
function incrementNumberAnimation($element) { | |
var from = $element.text(); | |
var to = $element.data('increment-to'); | |
$({number: from}).animate({number: to}, { | |
duration: $element.data('increment-duration'), | |
easing: 'swing', | |
step: function() { | |
$element.text(Math.ceil(this.number)); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment