views:

55

answers:

2

When I resize the browser window to a lower width than 477px, window.innerWidth or window.getSize().x (using mootools) still returns 477px.

Anyone ever had that problem? What's going on here?

The problem occurs in Firefox and Chrome.

A: 

Hi, welcome to SO!

When the code gets called, is the window resized? It might be the case where the call to window.getSize().x gets called before you resize the window. Maybe you should attach the call to an anchor element on your page and only call it after the resize.

Claudiu
Well, the window is already resized when the code gets called, I always test via the firebug console, and even there, when I get to see the event windows properties, innerWidth is set to 477.
sebcreative
Did you refresh Firebugs DOM-Tab before watching the properties. DOM- TAB won't refresh automatic.
Dr.Molle
Yes, it refreshed with the browser, but i tried with an alert instead of a console.debug() and it still didn't worked out
sebcreative
A: 

workaround: http://jsfiddle.net/H4snF/1 - window.getCoordinates().width returns fine.

Dimitar Christoff