English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The resize() method triggers the resize event, or attaches a function to be executed when the resize event occurs.
The resize event occurs when the document view (browser window) changes its size.
Trigger the resize event of the selected element:
$.resize()
Attach a function to the resize event:
$.resize(function)
Calculate the number of times the browser window is resized:
$(window).resize(function() { $("span").text(x++); });Test and see‹/›
Display the window width when resizing (or after):
$(window).resize(function() { $("span").text($(this).width()); });Test and see‹/›
Parameters | Description |
---|---|
function | Function executed each time the resize event is triggered |