+ 5

How to add elements in HTML at random positions without overlapping

How can i add an image to HTML multiple times at random positions without overlapping, using JavaScript ? I have an image of size 128x160. I tried using array to record previous indexes of image, but it didn't work for me.

20th Jul 2019, 6:26 AM
Subin Gyawali
Subin Gyawali - avatar
4 Antworten
20th Jul 2019, 7:24 AM
Calviղ
Calviղ - avatar
20th Jul 2019, 6:41 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 1
Calviղ Thanks for this perfect solution !
21st Jul 2019, 4:23 AM
Subin Gyawali
Subin Gyawali - avatar
+ 1
same
30th Sep 2019, 9:01 AM
Jeffrey Adjei
Jeffrey Adjei - avatar