mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Loading bg before transitioning
This commit is contained in:
@@ -366,11 +366,17 @@ function setBGimage(id){
|
||||
{
|
||||
$("#bgimage").css("background-image", "url(bg4.jpg);");
|
||||
}else if(window.mozInnerScreenX == null && !window.mobilecheck()){
|
||||
var bg = new Image();
|
||||
bg.src = "http://img.youtube.com/vi/"+id+"/0.jpg";
|
||||
$("#bgimage").addClass("noopacity");
|
||||
setTimeout(function(){
|
||||
$("#bgimage").css("background-image", "url(http://img.youtube.com/vi/"+id+"/0.jpg)");
|
||||
$("#bgimage").removeClass("noopacity");
|
||||
}, 1000);
|
||||
console.log(bg);
|
||||
bg.addEventListener("load", function(){
|
||||
setTimeout(function(){
|
||||
$("#bgimage").css("background-image", "url("+bg.src+")");
|
||||
//document.getElementById("bgimage").backgroundImage.src = bg.src;
|
||||
$("#bgimage").removeClass("noopacity");
|
||||
}, 1000);
|
||||
});
|
||||
}else if(window.mobilecheck()){
|
||||
$("#mobile-banner").css("background-image", "url(http://img.youtube.com/vi/"+id+"/hqdefault.jpg)");
|
||||
$("#mobile-banner").css("width",$(window).width());
|
||||
|
||||
Reference in New Issue
Block a user