🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

fittable is a jQuery plugin that automatically scales, crops and re-positions an element (e.g. images and videos) to fit within its parent container.

Resize

Documentation

jquery-fittable

A jQuery plugin to fit or fill an element inside its container.

<div class="some-container">   <img class="image-fit" src="example.jpg" width="640" height="480"> </div>  <div class="some-container">   <video class="video-fill" src="example.mp4" width="640" height="480"></video> </div>
$('.image-fit').fit(); $('.video-fill').fill();

jquery-fittable will use width and height attributes by default, or you can pass them in as options:

$('.example-fit').fit({   width: 640,   height: 480 });  $('.example-fill').fill({   width: 1200,   height: 800 });

You May Also Like