1) Script Title:
LightBox
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...box2/index.htm
3) Describe problem:
I'd like to print the image width and height in the title of the image.
1) Script Title:
LightBox
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...box2/index.htm
3) Describe problem:
I'd like to print the image width and height in the title of the image.
Print? I hope you don't mean for the printer only. Anyways, if not, just search in lightbox.js for the line that begins like this:
there's only one, change that whole line to:Code:Element.setInnerHTML( 'caption'
Make sure to include a title attribute with each rel="lightbox" link on your page, it can even be:Code:Element.setInnerHTML( 'caption', imageArray[activeImage][1]+' ('+imgPreloader.width+' x '+imgPreloader.height+')');
if you want.Code:title=" "
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Doesn't seem to work.
I didn't put the code where you said though... The thing is that I've rewriten the code where the link is.
This is where I'd like the wiidth and height to be a bit larger than the image.Code:return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="#" OnClick="MyWindow=window.open(\''+ddimageTitleURL+'\',\'Window\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600\'); return false;">'+ddimageTitle+'</a>'
So what can I write instead of: width=500,height=600\' ?
Well, you should put it right where I suggested. However, your modification:
is flawed. It should be:Code:return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="#" OnClick="MyWindow=window.open(\''+ddimageTitleURL+'\',\'Window\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600\'); return false;">'+ddimageTitle+'</a>'
So that the entire DD added function now looks like so:Code:return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="#" onclick="MyWindow=window.open(\''+ddimageTitleURL+'\',\'Window\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600\'); return false;">'+ddimageTitle+'</a>' : ddimageTitle;
Code:function getImageTitle(anchor){ //DynamicDrive.com added function that allows the caption("title") to be linked ("rev"). var ddimageTitle=anchor.getAttribute('title') var ddimageTitleURL=(ddimageTitle!=null && ddimageTitle!="")? anchor.getAttribute('rev') : null return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="#" onclick="MyWindow=window.open(\''+ddimageTitleURL+'\',\'Window\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600\'); return false;">'+ddimageTitle+'</a>' : ddimageTitle; };
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
OK, now let's see. After the lightbox displays the image, you want the user to be able to click on the caption in the lightbox and have it pop up a window with the same image in it with that window tailored to the dimensions of that image? Why?
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
The reason is.. well simple.
I hae a galery. You can view all photos but you can also click the "buy" button.
Here you'll see the shoosen picture and a number of options for buying the photo.
Therefore I have the popup-script and therefore I want to use the picture size (plus a fiew pixels).
To use it to resize my popup window.
Do you think it's "do-able"?
Yeah, I get it now. You cannot useimgPreloader.width/heightin thegetImageTitlefunction because they're not available yet, but you can use tokens in the string created by thegetImageTitlefunction later in the line I was talking about to replace them with theimgPreloader.width/heightvalues which will be available at that point. As it currently stands, if you are using thisgetImageTitlefunction:
You can use the 500 and the 600 as the tokens, and have this at theCode:function getImageTitle(anchor){ //DynamicDrive.com added function that allows the caption("title") to be linked ("rev"). var ddimageTitle=anchor.getAttribute('title') var ddimageTitleURL=(ddimageTitle!=null && ddimageTitle!="")? anchor.getAttribute('rev') : null return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="#" onclick="MyWindow=window.open(\''+ddimageTitleURL+'\',\'Window\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600\'); return false;">'+ddimageTitle+'</a>' : ddimageTitle; };Element.setInnerHTML( 'caption'line, like so:
to replace those tokens with the values now available plus whatever you like (in the above I add 20 to the width and 50 to the height).Code:Element.setInnerHTML( 'caption', imageArray[activeImage][1].replace(/500/, imgPreloader.width+20).replace(/600/, imgPreloader.height+50));
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
I really don't know what to say... You are my savier...
THANK YOU!!!!
Bookmarks