Takazudo hamalog

programming notes. mainly about JavaScript / jQuery. [@Takazudo] [takazudo@gmail.com] Hint: alt + /

cool guy

jQuery.loadImg - $.Deferred powered imgloader

2011/08/11 permalink

jQuery.loadImg is a imgLoader.

$.loadImg loads img then cache the element into the memory.
Once the imgloading ends, $.loadImg returns the cloned element of the cached img.
This may let you handle img loading easily.
works on jQuery 1.6.2.

$.loadImg('somewhere/img.png').then(function($img){
    $('body').append($img);
},function(error){
    alert(error.msg);
});

Check the following article to know what happens inside.

blog comments powered by Disqus

  1. fingaholichamalogからリブログしました
  2. hamalogの投稿です