Posted on 26/03/2014 16:50:55
Where do you use <!--@Gallery.Image.Metadata.title-->? If you just use it in the title attribute (if it's defined) then it will be used as the lightbox title:
<a href="<!--@Gallery.Image.Thumb.Large.Path-->" rel="lightbox[img]" title="<!--@If Defined(Gallery.Image.Metadata.title)--><!--@Gallery.Image.Metadata.title--><!--@Else--><!--@Gallery.Image.Name--><!--@EndIf-->"
Otherwise, you can add it to a custom data attribute
<a href="<!--@Gallery.Image.Thumb.Large.Path-->" rel="lightbox[img]" title="<!--@Gallery.Image.Name-->" data-metadata-title="<!--@If Defined(Gallery.Image.Metadata.title)--><!--@Gallery.Image.Metadata.title--><!--@EndIf-->">
and then change lightbox.js to use the data-metadata-title attribute if it's non-empty and use the title attribute otherwise.
In lightbox.js you have to change the line
this.imageArray.push([imageLink.href, imageLink.title]);
to
// Use data-metadata-title attribute as title if set. Otherwise, use title attribute
this.imageArray.push([imageLink.href, imageLink.getAttribute('data-metadata-title') ? imageLink.getAttribute('data-metadata-title') : imageLink.title]);
and change the line
return [anchor.href, anchor.title];
to
return [anchor.href, anchor.getAttribute('data-metadata-title') ? anchor.getAttribute('data-metadata-title') : imageLink.title];
I hope it makes sense.
Best regards,
Mikkel