jQuery resize() method
Example
Count the number of times the browser window is resized:
$
(
window
)
.
resize
(
function
(
)
{
$
(
'
span
'
)
.
text
(
x
+=
1
)
;
}
)
;
Try it »
Definition and Usage
The resize event occurs when the browser window is resized.
The resize() method triggers the resize event, or specifies a function to run when a resize event occurs.
Syntax
Trigger the resize event of the selected element:
$(
selector
).resize()
Try it
Add a function to the resize event:
$(
selector
).resize(
function
)
Try it
| Parameters | Description |
|---|---|
| function | Optional. Specifies the function to run when the resize event is triggered. |
jQuery event methods