Created
January 26, 2016 02:30
-
-
Save cdmz/7f57f3742a4ea30ce538 to your computer and use it in GitHub Desktop.
preload images javascript Jquery
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
jQuery.preloadImagesInWebPage = function() { | |
for (var ctr = 0; ctr < arguments.length; ctr++) { | |
jQuery("<img>").attr("src", arguments[ctr]); | |
} | |
} | |
//Carregando as imagens | |
$.preloadImages("image1.gif", "image2.gif", "image3.gif"); | |
//verificar se imagem foi carregada. | |
$('#imageObject').attr('src', 'image1.gif').load(function() { | |
alert('A imagem foi carregada'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment