Skip to content

Instantly share code, notes, and snippets.

@tarunama
Last active August 29, 2015 14:13
Show Gist options
  • Save tarunama/55e97661b817cea89cff to your computer and use it in GitHub Desktop.
Save tarunama/55e97661b817cea89cff to your computer and use it in GitHub Desktop.
[JavaScript] jQueryのメソッドにCallback関数を適応させる時のメモ ref: http://qiita.com/tarunama/items/7e5d1a6c5794c478a950
// 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