Slide up with "fit" images

I am using code to “fit” images on dynamic pages, and it is working great:
$w . onReady ( function () {
// Write your JavaScript here
$w ( ‘#teamImage’ ). fitMode = “fit” ;
});

However, often there is significant space left above and below.

  1. Is there a way to make elements below “slide up”?

  2. Is there a way to make the image itself “slide up”?

Thank you!