Created
February 25, 2013 01:18
-
-
Save omurphy27/5026694 to your computer and use it in GitHub Desktop.
JQUERY - Create a random number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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