Adding a callback to the resize function