I want to reload the first data at the end of the data and display the data in an infinite loop.

Hello. Always helpful community friends.
Again, I’m here to help.

Recently, I’ve been using the very handy Wix content management feature to create album information.

But I want to reload the first data at the end of the data and display the data in an infinite loop. How can I do that?

I wish there was a way.

thank you.

Hi there,

You you need to use the gallery’s current index to tell if you reached the end or the start of the gallery.

For example, when attempting to navigate to the next item, check if the current item is the last one, and reset it to the first item, or just move to the next item.

Now use use the event handlers to call the function, and perform the navigation.

const gallery = $w('#gallery');

$w('#next, #prev').onClick(event => {
    event.target.id === 'next' ? gallery.next() : gallery.previous()
})

Hope this helps~!
Ahmad

Thank you ‘Ahmad’, Does this mean that even if I use the ‘wix pro gallery function’ , it is possible to implement the same image form as above in conjunction with the content manager?

@noricoea correct :blush: but you need to assign the media to the gallery’s items property by code, or by connecting it to a dataset.

1 Like

@ahmadnasriya You are a genius.
Thanks to you, I was able to solve the problem.
Thank you very much.

@noricoea You’re very welcome, glad that I was able to help.