Skip to content

Instantly share code, notes, and snippets.

@tatimblin
Last active May 19, 2017 03:46
Show Gist options
  • Save tatimblin/41769549ea492437c4d0a33b72b56269 to your computer and use it in GitHub Desktop.
Save tatimblin/41769549ea492437c4d0a33b72b56269 to your computer and use it in GitHub Desktop.
var img = new Image();
img.src = 'img/assets/background.png';
var int = setInterval(function() {
if (img.complete) {
clearInterval(int);
document.getElementById('content').setAttribute('style', 'background-image: url(' + img.src + '); opacity:1;');
}
}, 50);
.content {
//visibility: hidden;
opacity:0;
transition: opacity 400ms ease;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment