SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2001
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding a parameter to picture URL in Lightbox

    Hello all

    Currently, I have Lightbox 2 working in the classical way, i.e. a link to an image (in my case it is a script, i.e. photo.php?id=123) with a rel="lightbox" attribute.

    I would like Lightbox to add *by itself* a parameter to the picture URL, so that photo.php?id=123 becomes for example photo.php?id=123&viewer=lightbox

    Again, Lightbox should add the parameter by itself, I do not want to put that parameter in the page from which Lightbox is called.

    Is that possible and what part of the lightbox code should I tweak?

    Thank you

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    It seems that this is the part of the code that you would want to be reworking.

    Code javascript:
    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.title]; }).
            uniq();
     
        while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
    }

    I have to head off now and cannot do this work for you, but that should help to give someone else a jump-start.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •