jquery - hide div until all background images have loaded -
is there way wait until background images have loaded before code executed? know works 1 image how can adapt various images?
var firstbackgroundimage = new image(); firstbackgroundimage.onload = function () { $('#main-slider').animate({opacity:1}),600; }; firstbackgroundimage.src = "http://www.domain.com/img/iphone.png"; html
<div id="main-slider"></div> css
#main-slider{ opacity:0; } thanks!
try:
$(window).load(function() { // code gets executed when content of page (including images) loaded });
Comments
Post a Comment