directive to handle window resize