Latest web development tutorials

jQuery resize () method

jQuery Event Methods jQuery Event Methods

Examples

Browser window is resized counts:

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

try it"

Definition and Usage

When adjusting the size of the browser window, resize event occurs.

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


grammar

Trigger the selected element resize event:

$(selector).resize() 尝试一下

Adding Functions to reisize event:

$(selector).resize(function) 尝试一下

参数 描述
function 可选。规定当 resize 事件被触发时运行的函数。


jQuery Event Methods jQuery Event Methods