views:

434

answers:

0

Hi,

I need to add a button link to lightbox 2. I have added the code to the title attribute of the anchor and while this works well, the code shows in the hover tool tip.

I read a recent question where the answer was to modify line 398 of lightbox.js as follows:

398: imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('paypalForm')));

to use 'paypalForm' rather than 'title' which worked well for this user. The lighbox 2 that downloaded a couple of days ago is coded differently to the above - which version or flavour is the above please?

This code following is from the lightbox.js that I have. I have been unsuccessful in trying to get the imageArray.push to recognise and load any attribute values other than href and title. Code is:

start: function(imageLink) {

    $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });

    // stretch overlay to fill page and fade in
    var arrayPageSize = this.getPageSize();
    $('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });

    new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });

    this.imageArray = [];
    var imageNum = 0;       

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

        while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
    }

any help most appreciated please?

thanks.