/    Sign up×
Community /Pin to ProfileBookmark

Detecting full screen window size

I’m working on a site which has a bit of a dodgy tabled layout. When the browser window gets too small the layout goes really bad.
As a quick fix, I thought i’d fix the size of the tables to full screen width, and this is where I ran into problems.
[I]window.width[/I] gives the full screen resolution, but not the available width and doesn’t take scrollbars and stuff into account.
I had a script for availble width and was going to sit down and work out full screen width for various resoltions, but that wasn’t working and there surely must be a better way?
Any ideas? Browser-safe code would be welcomed!!
Cheers

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@felgallMay 06.2005 — These two functions will retrieve the actual width and height of the browser window.

function pageWidth() {
return window.innerWidth != null?
window.innerWidth:
document.body != null?
document.body.clientWidth:null;}
function pageHeight() {
return window.innerHeight != null?
window.innerHeight:
document.body != null?
document.body.clientHeight:null;}
×

Success!

Help @hessodreamy 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.18,
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,
)...