The resize() method is an inbuilt method in jQuery which is used when the browser window changes its size. The resize() method triggers the resize event or attaches a function to run when a resize event occurs. jQuery has a built-in method for window resize events.
This syntax is used for cross-browser resize events.
Example 1: This example uses resize() method to count how many times browsers window resize.
- Before resize the browser windows:
- After resize the browser windows:
You can use the addEventListener() method to register an event handler to listen for the browser window resize event, such as window.addEventListener(‘resize’, …).
Example 2: This example display the size of resize windows.
- Before resize the browser window:
- After resize the browser window:
- Window | Window.requestAnimationFrame() Method
- Web Window API | Window statusbar property
- Web Window API | Window toolbar property
- Web Window API | Window locationbar property
- Web Window API | Window menubar property
- Web Window API | Window personalbar property
- Web Window API | Window scrollbars property
- Web Window API | DOM Window fullscreen property
- vector : : resize() in C++ STL
- CSS | resize Property
- jQuery | resize() with Examples
- Node Jimp | resize
- Resize image proportionally with CSS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.