PDA

View Full Version : Javascript Lightbox 2.03 Gallery Question



Cheng
08-09-2007, 03:18 PM
Hi.

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

http://www.dynamicdrive.com/dynamicindex4/lightbox2/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

jscheuer1
08-09-2007, 04:13 PM
In lightbox.js find:


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.

Cheng
08-09-2007, 04:36 PM
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

jscheuer1
08-09-2007, 05:31 PM
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));
}

Cheng
08-10-2007, 02:13 AM
.......that's what I was looking for.
Thanks a lot, I really do appreciate it.......Tommy.......

jscheuer1
08-10-2007, 02:40 AM
I made a mistake (just now corrected) in my last post, I left out:


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.

Cheng
08-10-2007, 08:53 AM
.......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.

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

jscheuer1
08-10-2007, 11:36 AM
Sure, why not?