+ 6

How could i make it at a random position ? HELP Please !

I want the red circle ⭕ to be at a random position at the web page . How could I do that? This is the code 👇👇 https://code.sololearn.com/WHU6BpX6HBg0/?ref=app

11th Jan 2019, 10:50 AM
Bono
Bono - avatar
1 Resposta
+ 2
Add this to your JS. window.onload = function(){ var c = document.getElementById("c"); c.style.marginTop = Math.random() * window.innerHeight + "px"; c.style.marginLeft = Math.random() * window.innerWidth + "px"; };
11th Jan 2019, 12:00 PM
James
James - avatar