Hi
I have a DIV background which I want to change randomly on page load from a selection of 3 PNGs.
I searched around and found this code:
$(document).ready(function() {
var randomImages = ['img-restaurante-1','img-restaurante-2','img-restaurante-3'];
var rndNum = Math.floor(Math.random() * randomImages.length);
$("div.lacarta").css({ background: "url(/images/" + randomImages[rndNum] + ".png) no-repeat" });
});
But for some reason it’s not working, any ideas?