So i try to random my background every second but my background cant fix with my website so i need to using css for doing that ( cant do that with this code ) . So can we using css in javascrpit ? this is my code
function changeBg() {
var images = [],
index = 0;
images[0] = "0.jpg";
images[1] = "1.jpg";
images[2] = "2.jpg";
index = Math.floor(Math.random() * images.length);
document.body.style.background ="#fff url('"+images[index]+"') no-repeat center center fixed";
}
setInterval(changeBg, 3000)
so i want all picture in this js to be using this css . how can i do that . Thank you guys so much :
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;