Skip to content

Instantly share code, notes, and snippets.

@agriboz
Created July 25, 2013 14:36
Show Gist options
  • Save agriboz/6080317 to your computer and use it in GitHub Desktop.
Save agriboz/6080317 to your computer and use it in GitHub Desktop.
$(window).load(function(){
var images = ['bg1', 'bg2', 'bg3'];
var imageRandom = Math.floor( Math.random() * images.length );
var imagesUrl = 'url(../img/' + images[imageRandom] + '.jpg)';
$('body').css('background-image', imagesUrl);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment