An element with a known absolute height can be centered in the viewport, and that is: centered vertically as well as horizontally, with a little css styling. This eliminates the need for any script or other code to reposition the element when the window is resized. It makes the move instantaneous.
Try to read between the lines.
#center {
text-align: center;
position: absolute;
overflow: auto;
top: 50%;
left: 50%;
width: 100%;
margin-left: -50%;
height: 98px; /* div's height */
margin-top: -49px; /* half of that */
}