homepage Welcome to WebmasterWorld Guest from 54.166.66.204
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
javascrip resize window?
wyverngod




msg:1478277
 6:22 pm on Apr 25, 2003 (gmt 0)

I'm looking for code that would resize a window on load based on my image size.. but take into account the tool bars. aka resize the browser so that my entire image is displaied. I hear netscape resizes based on the inside window and ie the window as a whole.. i need the inside for ie.. any comments? I was think about a no tool bar popup but i realy didnt liek the idea of not giving people a tool bar unless i just ass all the controlls to a "custom" tool bar built into the page... mainly back and forth and a close button.

and now the reason for this
I'm creating a web site that is for a friend to display his art.. we have a welcome image that wont look right unless the screen fits it. If i just have the page close and open a new one without a tool bar like a pop up im afraid some peoples popup software would not let the page be veiwable. but anyway else it will take aray from the look of the site.

 

Mike12345




msg:1478278
 10:38 am on Apr 28, 2003 (gmt 0)

Hopefully this is the soloution. But if you wanted it to determine the size of the image and rezise accordingly automatically, then i dont know how to help. Hefty script i should imagine.

But otherwise just change the values to the dimensions of the image. :)

<body onload="window.resizeTo(400,500);">

It works in NN7 and IE6 dont know about others.

:)

wyverngod




msg:1478279
 12:59 pm on Apr 28, 2003 (gmt 0)

that does resize but in IE it resizes the window and the tool bar take up some of the space there for the image isn't fully displayed. I think i found how to determin a window size but i'm still working on the code.. I'll post it if it works so others can use

Mike12345




msg:1478280
 1:20 pm on Apr 28, 2003 (gmt 0)

Please do, i would be interested to see how you do it. What if someone has addtional toolbars?

Best of luck :)

rainborick




msg:1478281
 2:32 pm on Apr 28, 2003 (gmt 0)

I've used this code to find the visible area in a browser window:

function getTZWindowWidth() {
var myWidth = 640;
if (document.documentElement && (document.documentElement.clientWidth document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
} else {
if (document.body && (document.body.clientWidth document.body.clientHeight)) {
//IE 4 compatible
myWidth = document.body.clientWidth;
}
}
if (document.layers) { myWidth = window.innerWidth; } // ns4 only
return myWidth;
} // end getTZWindowWidth

function getTZWindowHeight() {
var myHeight = 480;
if (document.documentElement && (document.documentElement.clientWidth document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
myHeight = document.documentElement.clientHeight;
} else {
if (document.body && ( document.body.clientWidth document.body.clientHeight)) {
//IE 4 compatible
myHeight = document.body.clientHeight;
}
}
if (document.layers) { myHeight = window.innerHeight; } // ns4 only
return myHeight;
} // end getTZWindowHeight

I have to admit that its been so long since I looked into this, that I don't remember the issue involved in what looks like special-casing IE6 in standards-compliant mode. I would expect you could search Google for the term "document.documentElement.clientWidth" and come up with some helpful references. Good luck!

HocusPocus




msg:1478282
 6:23 pm on Apr 28, 2003 (gmt 0)

So is there a solution to dynamically finding the dimensions of a gif/jpeg by using a client/server side script?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved