Skip to content

Instantly share code, notes, and snippets.

@omurphy27
Created February 25, 2013 01:18
Show Gist options
  • Save omurphy27/5026694 to your computer and use it in GitHub Desktop.
Save omurphy27/5026694 to your computer and use it in GitHub Desktop.
JQUERY - Create a random number
// to create a random number you do like so
var $aplus = Math.floor(Math.random()*356) + 4;
// more details on that syntax here: http://stackoverflow.com/questions/8002820/why-would-i-combine-math-floor-with-math-random
// here's a practical use below:
$('#mb_pattern div').on('hover', function() {
var $aplus = Math.floor(Math.random()*356) + 4;
// console.log($aplus);
$(this).transition({
'rotate' : $aplus + 'deg',
'scale' : 1.2
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment