Added condition setting to allow user to enter a function to run to determine whether the resize should occur or not