Forum Academy Marketplace Showcase Pricing Features

How to display one of range of images randomly?

Hey guys!

On one of my pages, I want to display one GIF from a range of GIFs. I would the GIF to be selected from the range somewhat randomly (so it would be different each time they landed on the page). I would then like there to be a button that can be pressed to change the image to another from the range, somewhat randomly.

Can this be replicated?

Cheers,
Dan.

Hi Dan,
Let’s say you have a list of pictures or a list of ruls to your GIFs called “List” (original, right? ^^)

THen I think that a possible solution could be to sort that list picking the “randomly sorten option”.
You can then get a specific item using the “:item#” operator.

If you want to get a different item at each click on a button, you might consider setting a custom state for instance on this button (integer), set it to 1 at page load. Then you can use this custom state as the argument of the “:item#” operator, and increase it each time the user presses on the button.