jQuery resize()Methods

jQuery 事件方法jQuery Event Methods

Examples

Count browser window resizing:

$(window).resize(function(){ $('span').text(x+=1); });

Try it yourself »

Definition and Usage

When the browser window is resized, the resize event occurs.

The resize() method triggers the resize event, or specifies a function to run when the resize event occurs.


Syntax

Trigger the resize event for the selected elements:

$(selector).resize() Try it yourself

Add a function to the resize event:

$(selector).resize(function) Try it yourself

Parameters Description
function Optional. Specifies a function to run when the resize event is triggered.


jQuery 事件方法jQuery Event Methods

Other Extensions