jQuery > Events

Resize event in jQuery

How to attach resize event to the browser window in jQuery?


To attach resize event to a html element, resize() method can be used.

<script>
        $(window).resize(function () {
            $("#divResize").text("Window size is: " + $(window).width());
        });
    </script>

In the above code when user resize the window then browser window width is be written inside “divResize”.

 Views: 4547 | Post Order: 82



Write for us






Hosting Recommendations