Minor change to the resizing events

The events were initially placed around the call to resize rather than
inside the resize function which didn't make sense.