improved the example for window.onresize