0

move an object to random positions using jquery

i'm trying to set up a button that when I click it, it will randomly generate coordinates to move the div square to a different spot using Jquery. Ideas on how I would set this up?

19th Jun 2019, 4:29 AM
Alex Peterson
Alex Peterson - avatar
2 Respostas
0
You could do it so, that the element has an absolute positiin, and fixed width, height; and then changing its left to a random number between 0 and 100 - width (%), and the same with height
19th Jun 2019, 5:09 AM
Airree
Airree - avatar
0
how would you write the code? thats what i’m not sure on.
19th Jun 2019, 1:14 PM
Alex Peterson
Alex Peterson - avatar