jQuery resize() Event

The jQuery resize() event triggers when size of the browser window changes.

Syntax of Resize Event

$(selector).resize(function) 

The selector is the element on which resize event to be occurred. The function is an optional parameter. This function is called when the resize event fired.


Example

<script>
$(document).ready(function(){
$(window).resize(function(){
alert("Window is resized.")
});
});
</script>

In the above example, an alert message is displayed when the user resized the window.





Read more articles


General Knowledge



Learn Popular Language