Last active
August 29, 2015 14:02
-
-
Save fronteer-kr/0b93740ccad1fa0d91fc to your computer and use it in GitHub Desktop.
jQuery Animate - 변수값만으로도..
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 rn = Math.round(Math.random() * 99999); | |
$("#msg").text("Random Number = " + rn); | |
var $el = $("#number1"); | |
$({ val : 0 }).animate({ val : rn }, { | |
duration: 2000, | |
step: function() { | |
$el.text(Math.floor(this.val).cf()); | |
}, | |
complete: function() { | |
$el.text(Math.floor(this.val).cf()); | |
} | |
}); | |
// cf() 는 천단위 comma용 (prototype 에 미리 정의해 둠) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment