-
-
Save shrutis22/6653ebff023f94d06774 to your computer and use it in GitHub Desktop.
Function to generate random positions for Divs
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
function randBlocks() { | |
var randYellow = parseInt(Math.random() * 10) % 4 | |
var yellow = randYellow * 100; | |
var randBlue = parseInt(Math.random() * 10) % 4 | |
var blue = randBlue * 100; | |
var randGreen = parseInt(Math.random() * 10) % 4 | |
var green = randGreen * 100; | |
opponentPos = [yellow, blue, green]; | |
$(".opponent-1").css("left", yellow); | |
$(".opponent-2").css("left", blue); | |
$(".opponent-3").css("left", green); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment