I've got a little code to randomize background pictures inside a div. I want to modify another div's background if a specified image is selected from the array. My code doesnt' work properly.
Here it is
var images = [ 'image_2.jpg', 'image_4.jpg', 'image_1.jpg'];
jQuery(' #header-top').css({'background-image': 'url(images/' + images[Math.floor(Math.random() * images.length)] + ')'});
if ( images =="image_1.jpg"){
jQuery('#promo').css({'background': 'url(images/image_back.jpg' });
};
Aucun commentaire:
Enregistrer un commentaire