resizeWindow now checks the parent element dimensions and resizes to that