/    Sign up×
Community /Pin to ProfileBookmark

two years back i developed this way of finding out window sizes, as i am fond of elastic pages.

function windowwide() {return this.window.innerWidth ? this.window.innerWidth : !document.documentElement ? document.body.clientWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;}

function windowhigh() {return this.window.innerHeight ? this.window.innerHeight : !document.documentElement ? document.body.clientHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;}

i now am busy re-evaluating this,i wanted it to OK in ie4-6 and ns4-7 for windows and mac os. of course there is more out there and i now like to know it does what it should

plz know english in not my native language.
thanks in advance .

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 13.2004 — Check this [URL=http://www.quirksmode.org/viewport/compatibility.html]page[/URL]
Copy linkTweet thisAlerts:
@David_HarrisonOct 13.2004 — [i]Originally posted by hastalavista [/i]

[B]two years back i developed this way of finding out window sizes, as i am fond of elastic pages.[/B][/QUOTE]
What does Javascript have to do with elastic pages? What if JavaScript is disabled or not supported?

Simply use CSS to layout your pages and set the widths of your elements in %.
Copy linkTweet thisAlerts:
@hastalavistaauthorOct 13.2004 — My assumption is that people have javascript on. It is part of the DOM. You'll miss things when you turn it off.

Percentage can not always be used. There are versions of msie that can only deal with whole numbers and not with broken numbers. That means you are dealing with a 100 * 100 grid when you work relative; a grid of boxes that are about 5 to 5 pixels. That is way too big.


regards
Copy linkTweet thisAlerts:
@JPnycOct 13.2004 — I guess if it's not enabled then it just won't work. % won't do anything for fontSize.
Copy linkTweet thisAlerts:
@David_HarrisonOct 13.2004 — Well I can create sites with CSS that work perfectly fine in as low as IE5, NN6 and Opera5 and the content can still be delivered effectively to even lower verions.

You don't have to use %'s for every single measurement you know. Just for the widths of various div tags (or whatever) that you are using to create the structure of the layout with. Take [url=http://www11.brinkster.com/hackus/]this[/url] page for example. I have given the side-bars fixed widths but I have given the centre column a % width. The layout fits perfectly from 640x480 all the way up to the higher resolutions such as 1280x960.

Dunsel - If you specify font sizes in %, then it allows the user to some control over the font size with their browser, (actually IE doesn't let users resize text that has a font size specified in px but all the other browsers do).

In most cases (unless you really know what you're doing) JavaScript should not be present where layout and navigation are concerned.

There are people (Charles from this forum for instance) who disable JavaScript by choice, yes they may miss out on some eye candy but they shouldn't miss out on anything vital.

There are also disabled users who browse the web, these can include blind users (for example), the browsers they use are audio or braille browsers and there is no way that these browsers [b]can[/b] support JavaScript.

Not everyone is as able bodied or as like minded as your good self. Try to keep that in mind when you use JavaScript.
Copy linkTweet thisAlerts:
@hastalavistaauthorOct 14.2004 — Nice site your hackus site. There are good graphics.

Besides that, it shows my point.

Lavalamp, take a seocond look at your side.

In different resolutions the site looks totally different.

In 640x480 res it has newspaper-like style, but the font is too big.

In 1024x768 res your article-links look like islands in the sea.

That means your text comes to the reader in a different context.

It is a nice site for your underground-club but you cannot sell this to a company.

The site you mentioned is not really dealing with windowsize.

There are three columns that are css or html-flushed left/centre/right.

The middle column is set to be 45% of total width or so.

I want to make a webdesign that is artisically ok.

You need javascript to do that.

A website look-and-feel should relate to who or whatever the website is about.

You cannot dismiss an artistic goal as eye-candy.

You also can't defend blind people in such a way.

They are not my audience.

Blind people will never appriciate graphic art, will never drive a car, and will never need a hackerssite to hack a computersystems cause that's all visual.

Being disabled is bummer.

When a aural browser can't filter the relevant information from a visual environment, then that is a bad aural browser.

Dunsel is right, i forgot to mention, if font-size should respond to window-size, then css has no solution.

It is up to the webdesigner to offer fontssizes that are readable.

Resolutions may vary, but screens keep on being between 14 and 19 inch.

<<Not everyone is as able bodied or as like minded as your good self.>>

Come on lavalamp, do you know it all so well?

That is soviet-style reasoning.

Do you throw away your good ideas when you need javascript to realize it?

I started to use this javascript-***** when i wanted to get all out of webdesign.

That's progress, man.

Don't let technical limitations be your limitations.

Walk the edge.

Now please let us get back to the point of this thread:

What is the right javascript-way of establishing the size of the viewport?

front-page of the new site i'm now working on: http://www.hastalavista.dds.nl/ozu/index.html

regards
Copy linkTweet thisAlerts:
@David_HarrisonOct 14.2004 — [i]Originally posted by hastalavista [/i]

[B]In different resolutions the site looks totally different.

In 640x480 res it has newspaper-like style, but the font is too big.

In 1024x768 res your article-links look like islands in the sea.

That means your text comes to the reader in a different context.

It is a nice site for your underground-club but you cannot sell this to a company.[/b]
[/quote]
Well I'm not trying to sell this to a company, I was using it to demonstrate that you can control the widths of your various layout elements with % measurements. So what if the site looks different at different resolutions? I wanted it like that. I used fixed widths for the side-bars and a % width for the main content area.

I didn't have to, I could make the entire layout fluid or none of the layout fluid if I'd really wanted. This is just an example and it's one specialised case and therefore doesn't "prove your point".

[i]Originally posted by hastalavista [/i]

[B]I want to make a webdesign that is artisically ok.

You need javascript to do that.[/b]
[/quote]
Why do you [i]need[/i] JavaScript?

[i]Originally posted by hastalavista [/i]

[B]A website look-and-feel should relate to who or whatever the website is about.[/b][/quote]
I totally agree.

[i]Originally posted by hastalavista [/i]

[B]You cannot dismiss an artistic goal as eye-candy.[/b][/quote]
No I cannot, but if some user groups cannot see your designs, they should at least be able to hear your textual content. Surely everyone has a right to access your page in one way or another.

[i]Originally posted by hastalavista [/i]

[B]You also can't defend blind people in such a way.

They are not my audience. [/b]
[/quote]
Why can't I, and what difference does it make to whether they are part of your audience or not?

[i]Originally posted by hastalavista [/i]

[B]When a aural browser can't filter the relevant information from a visual environment, then that is a bad aural browser.[/b][/quote]
Maybe it's not the browser that sucks...

[i]Originally posted by hastalavista [/i]

[B]Dunsel is right, i forgot to mention, if font-size should respond to window-size, then css has no solution.[/b][/quote]
Font-size has nothing to do with the window size. At all.

[i]Originally posted by hastalavista [/i]

[B]It is up to the webdesigner to offer fontssizes that are readable.

Resolutions may vary, but screens keep on being between 14 and 19 inch.[/b]
[/quote]
No, the user should make that choice. You should respect that choice by specifying all your font sizes in either % units or em units (1em = 100% = the font size of the parent element).

[i]Originally posted by hastalavista [/i]

[B]<<Not everyone is as able bodied or as like minded as your good self.>>

Come on lavalamp, do you know it all so well?

That is soviet-style reasoning.[/b]
[/quote]
What?

[i]Originally posted by hastalavista [/i]

[B]Do you throw away your good ideas when you need javascript to realize it?

I started to use this javascript-***** when i wanted to get all out of webdesign.[/b]
[/quote]
JavaScript is a good tool when used properly. And by properly I mean that when it is disabled the page is still accessible. JavaScript is an amazing thing, but it's not the answer to everything.
×

Success!

Help @hastalavista spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...