resize

Test page.

Events overview page.

The resize event fires when the user resizes the browser window or a resizable element.

Event IE 5.5 IE 6 IE 7 IE8rc1 as IE7 IE8rc1 as IE8 FF 2.0 FF 3.0 FF 3.1b2 Saf 3.0 Win Saf 3.1 Win iPhone 3G Chrome 1.0 Opera 9.62 Opera 10a Konqueror 3.5.7
On the window
Yes Yes Yes Buggy Yes Yes Yes

Is the resize event available on the window?

  • Safari iPhone fires this event at unpredictable times. Sometimes it fires them when the user zooms out completely, when the console is cleared and when you select a new radio button, but sometimes it doesn’t.
On the document
No No No No Yes Yes

Is the resize event available on the document?

On any element with resize
Untestable Untestable No Untestable No Untestable Untestable

Is the resize event available on an element with the CSS resize declaration?

Event bubbling

I'm not sure if this event should bubble up.

Untestable Untestable Untestable Untestable Yes Yes
  • In Opera 9.26 the event is captured when using attachEvent registration.
  • When using attachEvent registration, Opera fires the event on the window before the event on the document. (The event isn’t available on the window in any other registration.) An event on the window is equal to an event on the <body> in order to support ancient inline event handlers such as <body onload="something()>.
Method or property IE 5.5 IE 6 IE 7 IE8b2 FF 2 FF 3 Saf 3.0 Win Saf 3.1 Win iPhone 3G Opera 9.26 Opera 9.51 Konqueror 3.5.7

Amount of events

In Windows XP Home, “Show window contents while dragging” can be found in My Computer -> (right click) -> Properties -> Advanced -> Settings -> Visual effects.

But how many events fire, and when? That depends partly on your Windows settings (not tested on Mac or Linux).

If you switch “Show window contents while dragging” off, all browsers fire one resize event at the end of the resize (except for IE 5.5 and 6, which fire two).

If you switch it on the browsers do the following:

These compatibility tables are sponsored by

Google