Hello, I've seen this question asked many times before so I wanted to clarify the exact issue I've been having. A lot of others have asked for help with code to randomize a gallery when a page is loaded. I have implemented the following code in one of my pages in an attempt to randomize the entire gallery of 300+ images: $w.onReady(function () { let items = $w("#gallery1").items;items = shuffle(items);$w("#gallery1").items = items; });export function shuffle(array) {for (let i = array.length - 1; i > 0; i--) {const j = Math.floor(Math.random() * (i + 1));[array[i], array[j]] = [array[j], array[i]]; return array; } This code was taken exactly from another user, but when I implement it all I get is a blank page. I implemented the code again, but this time where the first chunk only executes when a button is pressed. When I press this button, it successfully randomizes the first 50 loaded images, but then I can't scroll down and load any more images. I'm looking for some code that will allow me to randomize all 300+ images, so when I load the page I can have the entire gallery random. Thank you.
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
Thanks for the quick reply! taking a look now
Are you using a Pro Gallery?
If you look here and scroll down to Notes you'll see that for a Pro Gallery you need to connect the gallery to a dataset first.
I'm trying to do this exact same thing! Is there currently a good solution for this?
How are you populating the Gallery?