I'm trying to create my own website and for that I am trying to create a page which randomises the gif and shows a quote each time you refresh the web page. The gif part works for now, but I want to add the quote to the gifs that show up. I don't want the quote to also be randomised. So i want something like:
gif '1': text 'hello', gif '2': text 'whatsup';
The javascript code I got:
var images = ['http://ift.tt/2y501t4',
'http://ift.tt/2y4dfsu',
'http://ift.tt/2y6GPez',
'http://ift.tt/2y3QBRa'];
$('.gif').css({'background-image': 'url(' + images[Math.floor(Math.random() * images.length)] + ')'});
Aucun commentaire:
Enregistrer un commentaire