Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Forked from srobbin/gist:3799775
Created December 22, 2017 05:58
Show Gist options
  • Save Happy-Ferret/a83d350337eb8fc722c9ca30c87e406e to your computer and use it in GitHub Desktop.
Save Happy-Ferret/a83d350337eb8fc722c9ca30c87e406e to your computer and use it in GitHub Desktop.
Random Backstretch image
<script>
// Create an array of images that you'd like to use
var images = [
'image1.jpg'
, 'image2.jpg'
, 'image3.jpg'
];
// Get a random number between 0 and the number of images
var randomNumber = Math.floor( Math.random() * images.length );
// Use the random number to load a random image
$.backstretch(images[randomNumber]);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment