XF 2.1 Add a caption/link to Lightbox

Zig

Member
Hello everyone,

I'm looking to add a "Go to post" link for images that appear in Lightbox/Lightslider carousel for a Thread Gallery add-on I'm developing. Currently the only "caption" that appears is the alt attribute of the img tag. I've looked through lightbox.less, lightslider.less, and carousel.less and tested a number of the classes provided there, yet none have provided the desired result---a link underneath the text from the alt attribute.

Pointers would be much appreciated!

Thanks,
zig
 
Just to add to the mix... LB seems to always output a <p> tag containing a link in the lg-sub-html div. However, this link is empty by default. I couldn't find any examples in existing templates on how to pass in the data needed to populate that link, though attachments listed in post footers manage to do so. This appears to be the key to resolving the issue, but there's no obvious solution in the template code.
 
Last edited:
I was able to resolve this by utilizing undocumented attributes that lightbox.js recognizes. Namely data-lb-caption-desc and data-lb-caption-href. Note that lb-caption-desc can be set in either the js-lbContainer or js-lbImage class, but lb-caption-href must be set in the js-lbImage class.
 
Back
Top Bottom