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

Jonathan Leto jaleto at gmail.com
Fri Aug 7 14:54:57 PDT 2009


The first google result for "jquery scale image" is
http://www.ollicle.com/eg/jquery/imagefit/ , which says it is "a
jQuery plugin which scales images to fit their parent container."

Looks like it could be what you want, but I have never tried it.

Good luck


On Fri, Aug 7, 2009 at 2:14 PM, Keith Lofstrom<keithl at kl-ic.com> wrote:
> 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?
> Keith
> (*) 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
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list


Jonathan Leto
jonathan at leto.net

More information about the Pdx-pm-list mailing list