How to modify this jQuery code that centers a div so that it centers it even if the browser's windows is being resized?
<p>I found this code at StackOverflow:</p>

<pre><code>/* Center Dish Popup */
jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
    this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
    return this;
}

$('#dish-popup').center();
</code></pre>

<p>It centers the div. But the div remains in the same place if you resize the browser's window. I would like to know how to change the code so that the div re-centers itself while the browser's window is being re-sized.</p>
