๐‘๐š๐ง๐๐จ๐ฆ ๐ฌ๐ญ๐ซ๐ข๐ฉ ๐›๐š๐œ๐ค๐ ๐ซ๐จ๐ฎ๐ง๐

Hi, I placed on my homepage a strip with an image in it as background (I use Wix in French so Iโ€™m not sure if strip is the good word).

I would love to be able to put more than one picture in this strip and everytime a visitor go on the page, the strip background choose to show a random picture that I selected.

Also, the random option with the common galleries would be nice too.

Thanks

Create a Database with pictures and connect the strip with that dataset.

function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}

export function dataset1_ready() {
let maxCall = $w(โ€œ#dataset1โ€).getTotalCount();
let randNum = getRandomInt(maxCall);
console.log(randNum);
$w(โ€œ#dataset1โ€).setCurrentItemIndex(randNum);
}

Hope I helped you :slight_smile:

Well, this code may probably be very helpful, and I am thankful for it. Unfortunately, I already tried many times to use Wix Code, create collections and all these things but it seems that I am genetically not made to understand that, whatever my efforts, thatโ€™s why I ask to the devs to make it.