![]() ![]() $( "body" ).prepend( "" + "The width of the window after resizing is " + $( window ).width() + "" ) Now let us see another simple example of how the resize() method can have the function that can include seeing the window width and height after resizing the browser window and this done using window.width() and window.height() in the function which is passed as the argument to the resize() method. This program’s output can be seen in the above screenshot when the code is executed it will give the count 0 then after we keep resizing the browser window it increments the count and displays as “window is resized _ times”. Then we define a window.resize() method for resizing the window of the browser and to trigger the resize event every time the window is minimized, maximized, etc can be done by defining a function in which we are just incrementing the count of resizing of the window each time when you resize the browser window and this function is passed to the resize() method so that it can display the number of times the browse window has been resized. ready function to tell the jquery that the document is ready for making changes to the page and this function runs only once. In the above code, the jquery code starts with the “$” symbol, and then we are defining the document. We are firstly declaring the variable “i” because to store the numeric value of the count of the window resizing. In the above program, we can see we have defined a jquery code inside the script tag in the head tag which is placed inside the HTML structure. Demonstration of resize() method with fucntion having resize event. Let us discuss examples of jQuery Window resize. This function returns a certain numeric value that specifies the number of times the window has been resized.
0 Comments
Leave a Reply. |