Having Trouble with Lightbox 2.03.3 in Safari 3.x?

Well I know I sure was. I came across a bug where images could be displayed smaller or bigger than they should depending on what you clicked on before that image.

I've patched the lightbox.js to make this bug go away. In lighbox class' changeImage method I modified the imgPreloader.onload function.

...
// once image is preloaded, resize image container
imgPreloader.onload=function(){
  Element.setSrc('lightboxImage', imageArray[activeImage][0]);

  //unimatrixZxero edited fist at 2008-02-20 23:25
  //adding these attr setters for bug fix in Safari 3.x
  Element.setWidth('lightboxImage', imgPreloader.width);
  Element.setHeight('lightboxImage', imgPreloader.height);
	
  myLightbox.resizeImageContainer(imgPreloader.width, 
                                  imgPreloader.height);

  //clear onLoad, IE behaves irratically with animated gifs otherwise 
  imgPreloader.onload=function(){};
}
...
photo
Sam Figueroa

I am a young web developer with skills in PHP, Magento, Ruby on Rails, and XHTML/CSS.

When I'm not coding I love to take pictures. I have a serious passion for photography. It's fulfilling in creative ways (Code Monkey quote). At first I thought it was a simple hobby but it seems to pull me back in more every day. Take a look at some of my pictures on flickr if you want to see some of my work.

Gerhart-Hauptmann-Str. 13
Nordwalde, 48356, NRW
Germany, Europe

iStockphoto Refferal Banner depicting iStockphoto logo