Do nothing if elemRatio or imgRatio is NaN to prevent error.