Results 1 to 8 of 8

Thread: Javascript Lightbox 2.03 Gallery Question

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Javascript Lightbox 2.03 Gallery Question

    Hi.

    I'm using this Lightbox Image Viewer 2.03 script (Demo 2) from the libary:

    http://www.dynamicdrive.com/dynamici...box2/index.htm

    And I was wondering if it is possible to change the text in the down left corner from "Image 1 of 22" and so on to something else.
    In the simple version were one has to open each image individually some text can be added but but in version 2.03 I can't figure it out.

    Thanks in advance,
    Tommy
    Cheng

  2. #2
    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

    In lightbox.js find:

    Code:
    	updateDetails: function() {
    	
    		Element.show('caption');
    		Element.setInnerHTML( 'caption', imageArray[activeImage][1]);
    		
    		// if image is part of set display 'Image x of x' 
    		if(imageArray.length > 1){
    			Element.show('numberDisplay');
    			Element.setInnerHTML( 'numberDisplay', "Image " + eval(activeImage + 1) + " of " + imageArray.length);
    		}
    Change the red parts as you see fit.
    - John
    ________________________

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

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question

    Hi John.

    Thanks a lot.
    This is a step forward but it still shows the image number.
    Isn't there a way to get rid of the count and just add a line of text instead?

    Thanks again,
    Tommy
    Cheng

  4. #4
    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

    Code:
    	updateDetails: function() {
    	
    		Element.show('caption');
    		Element.setInnerHTML( 'caption', imageArray[activeImage][1]);
    		
    		// if image is part of set display 'Image x of x' 
    		if(imageArray.length > 1){
    			Element.show('numberDisplay');
    			Element.setInnerHTML( 'numberDisplay', Any valid string(s) and/or string variable(s));
    		}
    Last edited by jscheuer1; 08-10-2007 at 02:37 AM. Reason: correct omission
    - John
    ________________________

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

  5. #5
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Exclamation

    .......that's what I was looking for.
    Thanks a lot, I really do appreciate it.......Tommy.......
    Cheng

  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

    I made a mistake (just now corrected) in my last post, I left out:

    Code:
    Element.setInnerHTML( 'numberDisplay', Any valid string(s) and/or string variable(s));
    You still need to tell the script which element to set the innerHTML for.
    - John
    ________________________

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

  7. #7
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    .......hi again.
    The previous code was working but not the last one.
    If I change the code marked in red to some text it's working fine.
    Code:
    	updateDetails: function() {
    	
    		Element.show('caption');
    		Element.setInnerHTML( 'caption', imageArray[activeImage][1]);
    		
    		// if image is part of set display 'Image x of x' 
    		if(imageArray.length > 1){
    			Element.show('numberDisplay');
    			Element.setInnerHTML( 'numberDisplay', Any valid string(s) and/or string variable(s));
    		}
    I hope I can leave it at this and people with another browser are able to use the gallery as I do.......Thanks again.......Tommy
    Cheng

  8. #8
    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

    Sure, why not?
    - 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
  •