window resizing problem

Next to .height() and .width() there is .outerHeight() and .innerHeight() (same for width as well). You might be looking for these methods to gather the browsers size, not only the size of the windows viewport.

Keep in mind that this not always works 100% across all browsers, so you always might run into problems if you need it pixel-perfect.