I recently encountered a couple of challenges while working on a reaction test:
Firstly, I wanted to incorporate a random pause (2-5 seconds) after the user clicks on a div.
Secondly, I aimed to have the divs appear five times in total, providing the player with 5 attempts.
To address the first issue, I experimented with utilizing the setTimeout function. Additionally, I tried using a 'for' loop to control how many times the div would be displayed for the second problem.
For instance:
for(var i = 1; i < 5; i++) {
$div.css({
left: Math.floor(Math.random() * widthMax),
top: Math.floor(Math.random() * heightMax)
});
}
Unfortunately, I was unable to find solutions to these challenges.
You can experiment with it here: http://jsfiddle.net/tghca/7/
Any assistance would be highly valued! Thank you!