jQuery resize() methodThe jQuery resize() method triggers a resize event when the size of the browser window changes. It binds the event handler to resize an event or trigger that event on an element. This method can be used to perform some required actions such as avoiding scrollbars when adjusting the elements of the page on window resize, and many more. If the resize event triggers and the element's dimension changes, the content inside the elements also adjusts as well. SyntaxThis method accepts an optional parameter function, which specifies the function to execute every time the resize event is triggered. Now, let's see an example of using the jQuery resize() method. ExampleIn this example, we are using the resize() method. Here, we are using the optional parameter of the resize() method. When the user resizes the window, the updated width and height of the window will be displayed on the screen. It will also display how many times the user tried to resize the window. When we change the height of the window, the updated height will change accordingly. Similarly, when we change the width of the window, the updated width will change accordingly. Test it NowOutput: After the successful execution of the above code, the output will be - When we try to resize the window, the output will be -
Next TopicjQuery siblings() method
|