I using this code but first image all time is not random. Can you tell me what code can use from start to end? I use this code.
$w.onReady(function () {
let slides = $w("#fullWidthSlides1").slides;
let numOfSlides = slides.length;
let indexes = slides.map((e, index) => index);
let rnd, nextSlide = 0;
shuffledIndexes();
function shuffledIndexes() {
for (let i = indexes.length - 1; i > 0; i--) {
rnd = Math.floor(Math.random() * (i + 1));
[indexes[i], indexes[rnd]] = [indexes[rnd], indexes[i]];
}
}
$w("#fullWidthSlides1").changeSlide(slides[indexes[0]])
.then(() => {
$w('#fullWidthSlides1').show();
})
setInterval(() => {
nextSlide++;
nextSlide %= numOfSlides;
$w("#fullWidthSlides1").changeSlide(indexes[nextSlide]);
}, 3000) //interval in milliseconds (in this example: 3 seconds)
});
The website is: https://www.dpelegal.co/ important is to be the first image random.the