[Pdx-pm] Browser window height, javascript, jquery

Keith Lofstrom keithl at kl-ic.com
Fri Aug 7 14:14:19 PDT 2009

I want to make my wydiwys presentation tool autoscale single
images to the browser window.  I want to fill as much of the
window as I can, while preserving the image aspect ratio. 
The math is easy, but learning the pixel height of the inside
of the browser window is surprisingly difficult.

I am using javascript and jQuery with the webslide pages.  Right
now, I am scaling the image to 100% height, querying it to see
what the height turns out to be, then rescaling down if it slops
over on width.  Which joggles the display if the browser window
is tall and narrow.   It would be nicer to know how big the window
is, do the math, and display the image correctly the first time.

I'm pretty new to all this, and a lousy programmer.  Can anyone
suggest some browser-independent(*) code that will provide the
height of the inside bounding box, and perhaps explain a little
bit of how it works and what might break it?  


(*) Okay, screw the really old browsers, but assume IE7/8, Firefox
2/3, Chrome, Safari, etc.  jQuery is cool because it provides a cross
platform API, but I haven't found a function that does what I want.

(ObRelevance) Most of wydiwys is written in Perl.

Keith Lofstrom          keithl at keithl.com         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs

More information about the Pdx-pm-list mailing list