Handle resize event