Forum Moderators: open

Message Too Old, No Replies

Live Updating window.innerWidth/height?

         

cookiemonster

12:48 am on Jul 26, 2010 (gmt 0)

10+ Year Member



Hi, I have a pretty simple question today,

I know
window.innerWidth
, and
window.innerHeight
return a user's window width and height on load.
I'd like to know if there's a way for these values to be constantly updated - for example, if a user resizes their window, the innerWidth and innerHeight values should update automatically.

Thanks!

Dijkgraaf

1:35 am on Jul 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could use a JavaScript timer.
But that wouldn't necessarily re-size those things you have sized using those attributes.
How are you using them?

cookiemonster

1:39 am on Jul 26, 2010 (gmt 0)

10+ Year Member



I'm using the attributes to keep some flash content at the same size as the window (minus a certain number of pixels, so I can't use 100% height and width)... I know it seems like a crazy idea, but I need to know if it can be done.

cookiemonster

3:23 pm on Jul 28, 2010 (gmt 0)

10+ Year Member



Dijkgraaf, wouldn't using a JavaScript timer theoretically be slow and inefficient? Are there any other ideas that come to mind?