Skip to content

Instantly share code, notes, and snippets.

@jbrz0
Created April 4, 2016 02:48
Show Gist options
  • Save jbrz0/581d65a3edcd72fc171de83abd18e0dd to your computer and use it in GitHub Desktop.
Save jbrz0/581d65a3edcd72fc171de83abd18e0dd to your computer and use it in GitHub Desktop.
jQuery random colour div
// Requires jquery color
$(document).ready(function() {
spectrum();
function spectrum(){
var hue = 'rgb(' +
(Math.floor(Math.random() * 256)) +
',' + (Math.floor(Math.random() * 256))
+ ',' + (Math.floor(Math.random() * 256))
+ ')';
$('#welcome').animate( { backgroundColor: hue }, 1000);
spectrum();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment