I'm not really sure of the best way to go here, two choices - you can try them both to see which, if either, is best (they both may be fine). OK, at the end of lightbox.js we have this:
Code:
function initLightbox() { myLightbox = new Lightbox(); }
Event.observe(window, 'load', initLightbox, false);
Add to it like so:
Code:
function initLightbox() {
var imgs=document.images;
for (var i_tem = 0; i_tem < imgs.length; i_tem++)
if(imgs[i_tem].parentNode.tagName.toLowerCase()=='a')
imgs[i_tem].parentNode.setAttribute('rel', 'lightbox', 0);
myLightbox = new Lightbox();
}
Event.observe(window, 'load', initLightbox, false);
Or like so:
Code:
function initLightbox() {
var imgs=document.images;
for (var i_tem = 0; i_tem < imgs.length; i_tem++)
if(imgs[i_tem].parentNode.tagName.toLowerCase()=='a')
imgs[i_tem].parentNode.rel='lightbox';
myLightbox = new Lightbox();
}
Event.observe(window, 'load', initLightbox, false);
Also, some folks may prefer:
Code:
document.getElementsByTagName('img')
to:
document.images is supported by more browsers but, the lightbox script itself will not work in browsers that don't support document.getElementsByTagName('img') and I think it works better in the browsers that do support it (less resources, faster or something).
Bookmarks