Return to Snippet

Revision: 12981
at April 2, 2009 18:42 by ira


Initial Code
$(document).ready(function(){

	bgImageTotal=20;

	randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;

	imgPath=('/my/image/path/'+randomNumber+'.jpg');

	$('h1').css('background-image', ('url("'+imgPath+'")'));

});

Initial URL

                                

Initial Description
really simple random bg image.  Save images starting at 1.jpg.  Put in your jquery selector.  Etc, etc.

Initial Title
random bg image

Initial Tags
css, jquery

Initial Language
jQuery