JS popup is not responsive to window resize events