Skip to content

Instantly share code, notes, and snippets.

@obihann
Last active August 29, 2015 13:57
Show Gist options
  • Save obihann/9806817 to your computer and use it in GitHub Desktop.
Save obihann/9806817 to your computer and use it in GitHub Desktop.
jQuery Image Preloader Function
$.fn.preload = ->
@each ->
$("<img/>")[0].src = this
$.fn.preload = function() {
this.each(function(){
$('<img/>')[0].src = this;
});
}

#jQuery Image Preloader

Usage

$(['img1.jpg','img2.jpg','img3.jpg']).preload();

Source

Stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment