Skip to content

Instantly share code, notes, and snippets.

@yusugomori
Created March 19, 2013 04:15
Show Gist options
  • Select an option

  • Save yusugomori/5193668 to your computer and use it in GitHub Desktop.

Select an option

Save yusugomori/5193668 to your computer and use it in GitHub Desktop.
var imgs = ['img_0.png', 'img_1.png', 'img_2.png']; // プリロードさせたい複数の画像
var dfds = [];
for(var i=0; i<imgs.length; i++) {
dfds.push( preload(imgs[i]) ); // dfds配列に dfd.promise() を格納
}
$.when.apply(null, dfds).done(function(){
/* 画像読み込み完了後の処理 */
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment