Email conversation
From | Adam Woods |
To | Me |
Subject | question |
Date | 13 October 2004 21:17 |
I am using your image popup autosize perfect fit script. Sometimes I am
displaying a image larger than my screen resolution. Is there a way to
limit the size so it doesn’t display bigger than the user screen??? It
would be very appreciated. Thanks!!!
From | Me |
To | Adam Woods |
Subject | Re: limiting image size in popup script |
Date | 14 October 2004 9:00 |
Adam,
after this line:
'var oH = document.images[0].height, oW = document.images[0].width;\n'+
add this (you may need to play with the numbers in the first line):
'var mH = screen.availHeight-50, mW = screen.availWidth-40;\n'+
'if( oH > mH || oW > mW ) {\n'+
'mH = mH \/ oH; mW = mW \/ oW;\n'+
'var zoomFactor = ( mH < mW ) ? mH : mW;\n'+
'oH = Math.floor( oH * zoomFactor );\n'+
'oW = Math.floor( oW * zoomFactor );\n'+
'document.images[0].height = oH;\n'+
'document.images[0].width = oW;\n'+
'}\n'+
Assuming I have got my maths correct, this should do what you need.
Hope this helps
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Adam Woods |
To | Me |
Subject | Re: limiting image size in popup script |
Date | 14 October 2004 17:25 |
Perfect....thank you so much