random generation of fa icons as the background

Hello AMC

I want to use JavaScript to randomly pick fa icons and place them in a grid (like background-image in css) with z-index: -1 so it basically acts like a sick background

could I get some help? specifically at the generation part


gonna post on Ask

  1. get list of all fa icons
  2. choose random ones
  3. paste them into a tag, x at a time
  4. paste multiple of those tags, y at a time
1 Like

So basically something like

or specific ones:

let icons = ['fa-gamepad', 'fa-gamepad-modern', 'fa-house', 'fa-moon'];
function randomicon(ico-list) {
  const chooseOne = Math.floor(Math.random() * icons.length);
  return icons[chooseOne];
} // i think


how again

It’s kind of weird posting on both AMC and Ask but I made a good post:

like so:

position: absolute;
top: /*Use javascript: (window.screenHeight/40*y) */;
left: /*Use javascript: (window.screenWidth/40*x) */;
z-index: -1;

use javascript to programmatically calculate CSS values

1 Like

hmm let me try that

also sorry that I didn’t reply for some time

1 Like

Is this resolved?

I eventually tried a different effect for the bg, forgot to mark this, sorry

1 Like



Lol its fine I was jsut looking at the bounty catagorey


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.