onresize event
Example
Execute JavaScript code when the browser is resized:
Try it »
Definition and Usage
The onresize event occurs when the window or frame is resized.
Syntax
In HTML:
<
element
onresize="
SomeJavaScriptCode
">In JavaScript:
window.onresize=function(){
SomeJavaScriptCode
};
| Parameters | Description |
|---|---|
| SomeJavaScriptCode | Required. Specifies the JavaScript to be executed when the event occurs. |
Browser support





All major browsers support the onresize event.
The following HTML tags support the onresize event:
, , ,, ,
Event Object