I need to change the background from a certain time, but the site was already half done so the background loading is being done in jquery with this function
$(".intro").backstretch("img/" + images[Math.floor(Math.random() *
images.length)] , { centeredX:true, centeredY:true});
I basically tried to do this
$(window).on('load', function () {
var today = new Date()
var curHr = today.getHours()
/*HORARIO Menor que 12 horas*/
if (curHr < 12) {
var images = ['london.png'];
$(".intro").backstretch("img/" + images[Math.floor(Math.random() *
images.length)] , { centeredX:true, centeredY:true});
}
else{
var images = ['outra imagem'];
$(".intro").backstretch("img/" + images[Math.floor(Math.random() *
images.length)] , { centeredX:true, centeredY:true});
}
}
Does anyone know why it does not work? ah and if you need the class .intro is here
.intro {
display: table;
width: 100%;
color: #fff;
text-shadow: 0 1px 3px rgba(0,0,0,.2);
height: 100%;
background: #000 url(../img/5.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
If somebody knows why not thank you, obs: if it is to do by css calling a class and passing the schedule to call another I can, but I want it that way, because it is already stylized, obs does not go into this function.