Fit function called on resize event