Can't get alt text for lightbox images using CMS?

Hello dear people :slight_smile:

I am building a website for my grand-father, he is a sculptor.

I can add a caption to a lightbox static image but can’t find a way add a caption when using lightbox pulling images from the CMS.

Any idea how to do that ? Can we do it natively without custom code ?





Here is my public share link: LINK
(how to access public share link)

I built a cloneable here that does that, give it a try.

2 Likes

It works like a charm, thank you so much for developing that snippet !
Wondering why @webflow isn’t implementing it natively ?

Thanks again @memetican , much apprecaite !

You want to know the weird thing- the position and style you see the caption was already built by Webflow into the lightbox. I’m just populating that element from the alt text.

My guess is that they started building the feature and then stopped to reconsider designer requirements on styling, links, multiline text… went down some rabbit holes… got lost in requirements… and then shelved it for a later date while they work on more critical things.

But that’s just my dev-theory.

2 Likes

thank you for this. Webflow’s original non CMC lightbox always had captions. Not sure why their CMS never had option. I added a simple if condition so that if an ‘alt’ isn’t present it doesn’t give the undefined error. As videos don’t have them. But this is awesome will share this wide.

1 Like

Thanks Jeremy, the library should ignore videos successfully, I had the same issue on a project as well- but you might have found a case it doesn’t detect successfully.

If you can find a situation where you can create an undefined result in the caption please share it in the Sygnal Attributes forum here, would like to add that improvement to the list.

That makes a lot of sense- it’s probably the HTML structure I’m seeing emitted.

Hi Michael, it was from the clone actually. I was mixing a bunch of galleries together though. Used the template page so I could test combination of the main image, video, and a collection list of additional images from multi-image fields. wrapped the caption bit in if (caption) {
} worked like a charm. I was so happy I didn’t have to figure this our from scratch.

Hi Jeremy, do you mean applying the Sygnal Attributes lightbox captions?

If so, post your question in our support forum there, and we’ll take a look at your configuration when we can.

1 Like

Can you confirm is it still working? It isn’t working for me.

Hey Muhammad, not sure what you’re asking.
Are you not seeing the captions in the cloneable?

I had to include a script in the head which I wasn’t doing. After adding that script tag its working now. Thanks for prompt reply.