我正在隨機顯示一幅完整的背景圖像,但我無法控制。隨機背景圖像以JavaScript啓動
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";
以空白屏幕。
我的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%;
}
可以什麼原因呢?
如果您的答案對您有用,並且您找到答案,您可能需要在下面標記並接受接受的答案:) – TrojanMorse
我無法在兩天內接受我自己的答案。 :) – sakarya