OK, I'm going to remove the archive from my previous post and put the corrected one here.
To answer your question, no, actually I am sure it does not, at least not in all cases. My logic was faulty. First I checked to see if the width was out of whack. If it was, I went with that as the limiting factor. Next, only if the width wasn't out of whack, I checked the height, etc - same thing, if it was, I based the limit on height. Finally, only if the width and height were not out of whack, did I check to see if they were both out of whack. Obviously, it never got that far, and even if it did, my way of choosing which limiting factor to go with in that case was flawed as well.
Here is the working code for testing, if you want to just paste it in -
In short, replace this (highlighted):
Code:
var bob=function(){
var plim=null;
if(getPageSize()[2]-50<=imgPreloader.width&&getPageSize()[3]-150>imgPreloader.height)
plim='width';
else if(getPageSize()[3]-150<=imgPreloader.height&&getPageSize()[2]-50>imgPreloader.width)
plim='height';
else if(getPageSize()[3]-150<=imgPreloader.height&&getPageSize()[2]-50<=imgPreloader.width)
plim=imgPreloader.height-getPageSize()[3]-150>imgPreloader.width-getPageSize()[2]-50? 'height' : 'width';
if(/Apple/.test(navigator.vendor)) plim=null;
Element.setSrc('lightboxImage', imageArray[activeImage][0]);
if(plim=='width'||plim==null)
imgPreloader.width=$('lightboxImage').width=Math.min(getPageSize()[2]-50, imgPreloader.width);
else imgPreloader.height=$('lightboxImage').height=Math.min(getPageSize()[3]-150, imgPreloader.height);
/*mark1*/ $('lightboxImage').style.visibity='hidden'
var tempd=$('lightboxImage').style.display
$('lightboxImage').style.display=''
if(plim=='width'||plim==null)
imgPreloader.height=$('lightboxImage').height=Math.min($('lightboxImage').height, imgPreloader.height);
else imgPreloader.width=$('lightboxImage').width=Math.min($('lightboxImage').width, imgPreloader.width);
$('lightboxImage').style.display=tempd;
$('lightboxImage').style.visibity='visible'
myLightbox.resizeImageContainer(imgPreloader.width, imgPreloader.height);
imgPreloader.onload=function(){}; // clear onLoad, IE behaves irratically with animated gifs otherwise
}
with:
Code:
if(getPageSize()[3]-150<=imgPreloader.height&&getPageSize()[2]-50<=imgPreloader.width)
plim=imgPreloader.height/(getPageSize()[3]-150)>=imgPreloader.width/(getPageSize()[2]-50)? 'height' : 'width';
else if(getPageSize()[3]-150<=imgPreloader.height)
plim='height';
else if(getPageSize()[2]-50<=imgPreloader.width)
plim='width';
Here is the updated archive:
Attachment 1875
Bookmarks