adds event listener on resize