Start array of images at specific index and then loop through back to that image

I have images in a table (each a separate row). Then I have created a relation to itself to create an array of those related images. I want the user to be able to click on a specific image in the gallery (grid collection) which will open up an overlay with a clickable gallery starting with that specific image. Then I want them to be able to click through that gallery from that image and loop through to the images prior to it. I was able to Slice the array to open to the image and get all the images after it, but I can’t figure out how to access the images prior to the one they clicked on. Any suggestions how I might do this?

Not exactly what you want, but perhaps Amit’s (@sardamit) setup will give you ideas.

How to Create an Image Gallery & Carousel

Ok, thanks for the reply. I’ll take a look.

1 Like