I have a Gallery that I have tied to a dataset. The dataset has 3 fields: title, description, image, which I then tie to the Gallery appropriately. That all works fine and looks great. I have it set that if you click an image it pops up in a lightbox.
I would like to link to a lightbox’ed image that is in the gallery. If I copy the URL when the image is lightbox’ed that URL works, however it appears the URL uses the index in the gallery for which image. So if I add a new image to the gallery then the URLs for all the existing images change.
Is there anyway to generate or come up with a direct link to a lightbox’ed image in a Gallery backed by a dataset such that the correct image will always show?
Yes that is because each time you add a new picture to the gallery it will alter it, you can see more here about it in the Wix Gallery API.
https://www.wix.com/corvid/reference/$w.Gallery.html#currentIndex
If you want to look at setting the gallery yourself, then you can try looking at using Wix Gallery API and the items function.
https://www.wix.com/corvid/reference/$w.Gallery.html#items
Set the list of items for a gallery
$w("#myGallery").items = [{
"type": "image",
"alt": "A beautiful view",
"title": "A View",
"src": "wix:image://v1/99bc1c6f66444769b531221214c885ac.jpeg/A%20View.jpeg#originWidth=3264&originHeight=2448"
}, {
"type": "video",
"description": "Another beautiful view",
"title": "Another View",
"src": "wix:video://v1/80c05f_e2c524db1f264178a8558c92dbf76fb0/_#posterUri=80c05f_e2c524db1f264178a8558c92dbf76fb0f000.jpg&posterWidth=1920&posterHeight=1080"
}];
As for code further code options, then you can look at previous forum posts.
Or have a look at Vorbly’s great little example here about gallery for dynamic page.
https://www.vorbly.com/Vorbly-Code/WIX-GALLERY-IMAGES-FROM-DATABASE
Thanks. I was afraid that might be the answer and that it would not be possible to do what I want to do with the gallery as-is. I’ll have to work on a bit more creative solution. It shouldn’t be too bad, I just didn’t want to jump to that if there was something built in I was just missing.