Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74735

Move array item when rendered on html page

$
0
0

Is there a way to move an element rendered in html that is stored inside of an array?

My code generates a new div every time a function is called, that div has an animation class added to it, to make it fall down the screen. Then I need to randomly move its X position by a number of pixels.

let num = Math.floor(Math.random() * 5);
 array.forEach((item) => {
   item.style.left = `${num}px`;
 });


Viewing all articles
Browse latest Browse all 74735

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>