Skip to content

Instantly share code, notes, and snippets.

@hayatbiralem
Last active December 14, 2015 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayatbiralem/5118691 to your computer and use it in GitHub Desktop.
Save hayatbiralem/5118691 to your computer and use it in GitHub Desktop.
How can I check if a background image is loaded?
// Source: http://stackoverflow.com/questions/5057990/how-can-i-check-if-a-background-image-is-loaded
$('<img/>').attr('src', 'http://picture.de/image.png').load(function() {
$('body').css('background-image', 'url(http://picture.de/image.png)');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment