Last active
August 29, 2015 14:13
-
-
Save tarunama/55e97661b817cea89cff to your computer and use it in GitHub Desktop.
[JavaScript] jQueryのメソッドにCallback関数を適応させる時のメモ ref: http://qiita.com/tarunama/items/7e5d1a6c5794c478a950
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
// main | |
$("#hoge").click(function () { | |
console.log("function main start"); | |
// 適当なメソッド | |
console.log("method animate start"); | |
var value; | |
$("#foo").animate({ | |
right: 100 | |
}, 1000 ,callback(value) | |
); | |
console.log("method animate end"); | |
console.log("function main end"); | |
}); | |
// callback関数 | |
var callback = (function(value) { | |
console.log("function callback start"); | |
if (value !== "undefined") { | |
console.log("condition true"); | |
} | |
console.log("function callback end"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment