Reduce margins by 25 pixels from dynamically generated height with jQuery
<p>I want to resize an image with the class of mainImg using jQuery depending on the viewport size. Using the following script I can get the image to resize to the exact viewport height available, but I want to reduce the size by 20px on the top and 50px on the bottom margin to create some white space.</p>

<pre><code>var viewportHeight = $(window).height();
$(document).ready(function() {
  $('.mainImg').css({ height: viewportHeight});
});
</code></pre>
