Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery resize() method

jQuery resize() method

jQuery event methods jQuery event methods

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 jQuery event methods