For anyone having problems using this script from inside a Iframe, I have found a solution. It may not be the best solution, I'm a relative novice at this stuff, but it seems to work ok.
Insert the script calls into the header of the PARENT html file.
In the Iframe HTML, change the href of your link to javascript
:Void(0) and add an onclick call to a function function(this). Also create a form with a hidden form field with a value = to what the href of your link originally was.
In the parent file create 2 functions that does the following.
Function cloneObject(what) {
for (i in what) {
this(i) = What(i);
}
}
rename the function below to the same as the onclink function in your link…
Function function(obj) {
var newobj = new cloneObject(obj);
var iframe = document.getElementById("iframename"); this has to be the name of your iframe.
var iframedoc = iframe.document;
var iframeForm = iframedoc.getElementById("formname); this has to be the name of your form.
var hrefvalue = iframeForm.hiddenfieldname.value; this has to be the name of your hidden field.
newObj.href = hrefValue
showLightbox(newobj);
}
I had to remove a section of the lightbox.js file that didn't like dealing with a copy of the link rather than the link itself.
The problem code was this:
if(objLink.getAttribute('title')){
objCaption.style.display = 'block';
//objCaption.style.width = imgPreload.width + 'px';
objCaption.innerHTML = objLink.getAttribute('title');
} else {
objCaption.style.display = 'none';
}
Removing it didn't seem to have a negative effect on the script.
There is probably a more elegant way to approach this, but my skills are not quite up to the task.
Sean