Results 1 to 2 of 2

Thread: Adding a second caption to Lightbox 2

  1. #1
    Join Date
    Apr 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Adding a second caption to Lightbox 2

    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 )

    Line 153
    Code:
                Builder.node('div', {id:'imageDataContainer'},
                    Builder.node('div',{id:'imageData'}, [
                        Builder.node('div',{id:'imageDetails'}, [
                            Builder.node('span',{id:'caption'}),
                            Builder.node('span',{id:'caption2'}),
                            Builder.node('span',{id:'numberDisplay'})
    Line 178
    Code:
            (function(){
                var ids = 
                    'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' + 
                    'imageDataContainer imageData imageDetails caption caption2 numberDisplay bottomNav bottomNavClose';
    Line 219
    Code:
            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]; }).
                    uniq();
    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)
    Code:
        //  updateDetails()
        //  Display caption, image number, and bottom nav.
        //
        updateDetails: function() {
        
            // if caption is not null
            if (this.imageArray[this.activeImage][1] != ""){
                this.caption.update(this.imageArray[this.activeImage][1]).show();
    
            }
    Any help with this will be greatly appreciated!

  2. #2
    Join Date
    Apr 2009
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    umm am I even on the right track on this?

    Come on guys at least give me some clues

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •