I'm tring to show randomly a full background image, but I con't.
var images = [],
index = 0;
images[0] = "img/y0.gif";
images[1] = "img/y1.gif";
images[2] = "img/y2.gif";
images[3] = "img/y3.gif";
images[4] = "img/y4.gif";
images[5] = "img/y5.gif";
index = Math.floor(Math.random() * images.length);
document.body.style.background = "url('+images[index]+') no-repeat center center fixed";
Taking blank screen.
My css:
@import url(http://fonts.googleapis.com/css?family=Advent+Pro:100);
html {
margin: 0;
padding: 0;
width:100%;
height:100%;
}
body {
background-size: cover;
height: 100%;
}
What can the reason be?