Improving triggering of window resize