The yellow square is positioned with
<div style='position:absolute; right:0px;bottom:0px; width:150px;height:150px; background:yellow'>
It should always be aligned right-bottom, applied to the browser window.
Note: if you also change window width, the problem does not occour. The box is also repositioned if the scrollbar gets hidden or shown (which changes the innerWidth).