Last active
January 1, 2016 18:59
-
-
Save franksmule/8187358 to your computer and use it in GitHub Desktop.
Fade in high resolution image, where body is initially set to low resolution image.
This file contains hidden or 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(function ($) { | |
var newpic = new Image(); | |
newpic.onload = function() | |
{ | |
var $div = $('<div id="temp-background"/>').css({ | |
'background-image': 'url(low-resolution-image.jpg)', | |
'position': 'absolute', | |
'height' :'100%', | |
'width' :'100%', | |
'z-index' :'-1', | |
'top' :'0px', | |
'left' :'0px', | |
}); | |
$('body').append($div); | |
$("body").css('background-image', 'url(high-resolution-image.jpg)'); | |
$('#temp-background').fadeOut(1000); | |
}; | |
newpic.src = 'high-resolution-image.jpg'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment