Trying to build a Gallery with new slider Element

I was playing around with the new slider element and was wondering, if it would be possible to create a gallery with it.

the setup would look like this:

  • a set of images that are assigned to a specific page using ACF Pro
  • a looper outputting these image
  • each image would be clickable and open up a modal containing a slider that opens up that specific image, but also contains the other ones

Now my question is: Is it possible to open up the slider at a specific index?
For example when i click the second image, i would like the slider to start at the second slide.

Hi @sparko,

I’m sorry, this isn’t really a good option for making galleries inside of modals. Technically you could put a slider inside a modal, but there wouldn’t be a way to target specific slides. We have plans to make a modern lightbox feature, but that isn’t a high priority at the moment.

We are however working on a feature that will allow creating more front end behaviors in a declarative fashion via Custom Attributes. Discussion - Custom Attribute Behaviors This system will have events that let you run actions when a modal opens/closes. We could also add some actions that cause a certain slide to be opened. With a bit of composing things together, what you’re saying could be possible, but we’re not quite there just yet.

2 Likes

Thank you for the explanation! Looking forward to these new features!

You’re welcome!