View Full Version : Adding a second caption to Lightbox 2

04-05-2009, 02:24 PM
Hi guys!

You know when Lightbox 2 finds the title=" " attribute in a link and it displays it as a caption below the image?

Well what I'm trying to do is adding a second (and even a third?) caption, so for instance I would add title2=" " and title3=" " to a link, and Lightbox would grab those texts and display them as additional captions.

Marked in yellow is what I added to 'lightbox.js' (please bear in mind I'm not a programmer, so it's possible these changes make no sense at all :D)

Line 153

Builder.node('div', {id:'imageDataContainer'},
Builder.node('div',{id:'imageData'}, [
Builder.node('div',{id:'imageDetails'}, [

Line 178

var ids =
'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
'imageDataContainer imageData imageDetails caption caption2 numberDisplay bottomNav bottomNavClose';

Line 219

if ((imageLink.rel == 'lightbox')){
// if image is NOT part of a set, add single image to imageArray
this.imageArray.push([imageLink.href, imageLink.title, imageLink.title2]);
} else {
// if image is part of a set..
this.imageArray =
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
collect(function(anchor){ return [anchor.href, anchor.title, anchor.title2]; }).

Line 326 (and finally this part that supposedly displays the caption on the image, but I'm not sure what to do here so I didn't add anything)

// updateDetails()
// Display caption, image number, and bottom nav.
updateDetails: function() {

// if caption is not null
if (this.imageArray[this.activeImage][1] != ""){


Any help with this will be greatly appreciated!

04-09-2009, 03:33 PM
umm am I even on the right track on this?

Come on guys at least give me some clues :D:D