fix entire window jumping around bug on IE and Chrome
cleaner code for jumping around bug fix