Cross-browser window resize event - JavaScript / jQuery

Viewed 269819

What is the correct (modern) method for tapping into the window resize event that works in Firefox, WebKit, and Internet Explorer?

And can you turn both scrollbars on/off?

11 Answers
$(window).bind('resize', function () { 

    alert('resize');

});

Since you are open to jQuery, this plugin seems to do the trick.

hope it will help in jQuery

define a function first, if there is an existing function skip to next step.

 function someFun() {
 //use your code
 }

browser resize use like these.

 $(window).on('resize', function () {
    someFun();  //call your function.
 });
Related