JQuery has a built-in method for this: $(window).resize(function () { /* do something */ }); For the sake of UI responsiveness, you might consider using a setTimeout to call your code only after some number of milliseconds, as shown in the following example, inspired by this: function doSomething() { alert("I'm done resizing for the moment"); }; var resizeTimer; $(window).resize(function() { clearTimeout(resizeTimer); resizeTimer = setTimeout(doSomething, 100); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)