LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG-Webdev] Resizing windows

[ILUG-Webdev] Resizing windows

adam beecher lists at spamfilter.cc
Tue Mar 11 10:53:32 GMT 2003


Hi Niall,

The PHP vars $w and $h below are the width and height dimensions from
getimagesize(), so swap them out with the dimensions you want. The first
resizeTo is required by IE as a reference for the second resizeTo. To add
whitespace around the image, add it to the JavaScript 'w' and 'h' vars in
the code just after the first resizeTo.

<script language="javascript" type="text/javascript">
 <!--
  var ie, nn;
  if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
   nn = (navigator.appName == "Netscape") ? 1 : 0;
   ie = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
  }
  if (nn) {
   self.innerWidth = <?=$w?>;
   self.innerHeight = <?=$h?>;
  } else {
   self.resizeTo(100, 100);
   w = (100 - self.document.body.clientWidth) + <?=$w?>;
   h = (100 - self.document.body.clientHeight) + <?=$h?>;
   self.resizeTo(w, h);
  }
 // -->
</script>

HTH,
adam

_____________________________________________________________
If I think homophones are gay, does that make me homophonic?
http://scut.cc/?w5VV45DK


> -----Original Message-----
> From: webdev-bounces at linux.ie [mailto:webdev-bounces at linux.ie]On Behalf
> Of Niall O Broin
> Sent: 11 March 2003 00:49
> To: webdev at linux.ie
> Subject: [ILUG-Webdev] Resizing windows
>
>
> I have code which displays a largish image in a preview window,
> together with
> some information about the image. I use this javascript to neatly
> resize the
> window for the size of the content:
>
>
> window.innerHeight = document.height + 20;
> window.innerWidth = document.width + 20;
>
> which very nicely resizes the window based on how much space its
> content needs
> leaves just a little blank all round. However this code only works in
> Navigator 4.7 so as you can imagine, not many people get the
> benefit of it
> any more.
>
> For other browsers, I pass window sizes from the server. However,
> these are
> only approximations, and can result in my having windows with scrollbars,
> which is exactly what I want to avoid. Is there some nifty DOM
> based way of
> doing something like this for current browsers ?
>
>
>
>
> Niall
>
>
> --
> ILUG Web Development
> http://mail.linux.ie/mailman/listinfo/webdev/
>



More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell