I found this code at StackOverflow:
/* 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();
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.
That should do the trick