Jump to content

Random image replace from array?


Helmet

Recommended Posts

This is probably not that complicated, but I'm fairly new to JS and can't quite figure out how to do this. I need to have 36 images on a page, their src and link href values pulled from a db with php (I'm fine with that part) and I'd like these images to randomly replace by others. So I'm thinking I need to build a javascript array of say, 72 images, display 36 of them, and then have some kind of random timing where a random image is replaced by the next one in the array. Does this make sense? Is that a reasonable approach?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.