PDA

View Full Version : Lightbox Caption Link without Upgrading...



witchyweb
09-13-2008, 12:04 AM
Lightbox Image Viewer

http://www.dynamicdrive.com/dynamicindex4/lightbox/index.htm

Hi everyone,

I'm using the original lightbox, which is perfect for my needs EXCEPT that I would like to take advantage of the feature to hyperlink the caption text.

I've added this snippet to my javascript file:

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="'+ddimageTitleURL+'" class="ddcaptionurl">'+ddimageTitle+'</a>' : ddimageTitle
};

and added the "rev" tag to my anchor tag on the webpage, but nothing's happening. I'm no javascript pro- am I missing anything? Is there competing code in the original lightbox script?

The only major tweak to the original code was to remove hideLightBox everywhere except for the close button. Everything else is working perfectly, it's just that the caption text isn't linked.

Thanks for your help.

witchyweb
09-13-2008, 12:33 AM
I found a work-around in this thread:

http://www.dynamicdrive.com/forums/showthread.php?t=20140

Thanks anyway :)