Skip to content

Instantly share code, notes, and snippets.

@gavinblair
Created June 16, 2011 15:06
Show Gist options
  • Save gavinblair/1029443 to your computer and use it in GitHub Desktop.
Save gavinblair/1029443 to your computer and use it in GitHub Desktop.
Trigger an event after specific background images have been loaded
​$('<img>')​.attr('src',function(){
return $('#mydiv1').css('background-image');
})​​​.load(function(){
​$('<img>')​.attr('src',function(){
return $('#mydiv2').css('background-image');
})​​​.load(function(){
$('<img>')​.attr('src',function(){
return $('#mydiv3').css('background-image');
})​​​.load(function(){
//done loading background images of all 3 divs
})​;
})​;
})​;
@gavinblair
Copy link
Author

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