Simple way to add a caption to an image in a ColorBox lightbox?

10,029

The easiest way is provided by the plugin. Just put your text in the relevant image's TITLE attribute. Here is a code snippet from the plugin's demo page:

<a class="group1 cboxElement" href="../content/ohoopee1.jpg" title="Me and my grandfather on the Ohoopee.">Grouped Photo 1</a>
Share:
10,029
Nelluk
Author by

Nelluk

Updated on June 17, 2022

Comments

  • Nelluk
    Nelluk almost 2 years

    I have a very simple ColorBox gallery setup just like the examples. Simple tags with the same group name as their class. I would like an easy way to display a caption or title for each image. Ideally just taken from the images alt attribute or something similar. I have found some solutions that involve calling a title() function but I don't understand how to implement them. Thanks!