Results 1 to 6 of 6

Thread: lightbox not loading

  1. #1
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default lightbox not loading

    1) Script Title: Lightbox 2.03

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...box2/index.htm

    3) Describe problem: I am not sure if I have the code wrong, if it is not playing well with the other scripts on the page or if lightbox doesn't like area maps (or none of the above).

    Any help is much appreciated.

    Here's a link to my test page:
    www.mattsteffen.com/design

  2. #2
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think I've ruled out the area maps as being the problem. Still having no luck getting it to operate.

    I may have to stop looking at it for awhile...........

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Two major problems:

    1 ) Your fault - you haven't uploaded the stylesheet to the server, or if you did, it isn't here where the page expects it:

    Code:
    <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
    which would be here (in absolute terms):

    Code:
    http://www.mattsteffen.com/design/css/lightbox.css
    I just found it, it's here:

    Code:
    http://www.mattsteffen.com/css/lightbox.css
    so use:

    Code:
    <link rel="stylesheet" href="http://www.mattsteffen.com/css/lightbox.css" type="text/css" media="screen" />
    2 ) Not your fault - there is a bug in the script for area tags that have group names included in their rel="lightbox" attribute. To fix that, open lightbox.js in a text only editor like NotePad and around line number 370 or so, change this:

    Code:
     . . .
    		hideFlash();
    
    		// stretch overlay to fill page and fade in
    		var arrayPageSize = getPageSize();
    		Element.setHeight('overlay', arrayPageSize[1]);
    
    		new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: 0.8 });
    
    		imageArray = [];
    		imageNum = 0;		
    
    		if (!document.getElementsByTagName){ return; }
    		var anchors = document.getElementsByTagName('a');
    
    		// if image is NOT part of a set..
    		if((imageLink.getAttribute('rel') == 'lightbox')){
    			// add single image to imageArray
    			imageArray.push(new  . . .
    to this:

    Code:
     . . . 
    		hideFlash();
    
    		// stretch overlay to fill page and fade in
    		var arrayPageSize = getPageSize();
    		Element.setHeight('overlay', arrayPageSize[1]);
    
    		new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: 0.8 });
    
    		imageArray = [];
    		imageNum = 0;		
    
    		if (!document.getElementsByTagName){ return; }
    		var anchors = document.getElementsByTagName(imageLink.tagName);
    
    		// if image is NOT part of a set..
    		if((imageLink.getAttribute('rel') == 'lightbox')){
    			// add single image to imageArray
    			imageArray.push(new . . .
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    worked like a charm.

    john, i can't thank you enough.

  5. #5
    Join Date
    Aug 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by enin View Post
    worked like a charm.

    john, i can't thank you enough.
    Yea he's an angel

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Just an added note here, for full compatibility across image sets that are represented by both <a> and <area> tags, this code:

    Code:
    var anchors = document.getElementsByTagName('a');
    should really be expanded to:

    Code:
    var l=document.getElementsByTagName('a');
    var a=document.getElementsByTagName('area');
    var anchors = [];
    for (var i = l.length-1; i > -1; --i)
    anchors[i]=l[i];
    for (var i = a.length-1; i > -1; --i)
    anchors.push(a[i]);
    This will support one, the other, or both type tag and will work for the original problem here as well as for more situations than the original solution did. However, as long as all image set(s) use only <a> or only <area> tags, the original solution is sufficient.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •