Lightweight jQuery Responsive iFrame Plugin - FitFrame.js

File Size: 12.7 KB
Views Total: 5244
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Lightweight jQuery Responsive iFrame Plugin - FitFrame.js

iFrame is an useful Html tag that provides a free way to embed any DOM elements from external sources like Youtube/Vimeo videos. FitFrame.js is a cross browser and cross domain jQuery iFrame plugin for responsive web layout that allows you to set the size of the iFrame element to fit the container by using wrap or resize modes.

See also:

Basic Usage:

1. Load the jQuery javascript library and FitFrame.js script at the bottom of the page.

<script src=""></script> 
<script src="jquery.fitframe.js"></script> 

2. Embed an video from Vimeo as an example.

<div class="container">
<iframe src="" width="600" height="338" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

3. Call the plugin on document ready and specify the mode option.

mode: 'resize'

4. Available options.

  wrapperCssClass: 'fitframe-wrap',
  iframeCssClass: 'fitframe',

  // The default mode of FitFrame.js is wrap and uses intrinsic ratios to make the iframes responsive.
  mode: 'wrap', 

  // Fit iframe to container height
  fitHeight: false,

  containerHeight: function() { return this.element.height(); },
  containerWidth: function() { return this.element.width(); }


Change log:


  • Fixed multiple-wrap issue when calling fitFrame('update').


  • Container dimensions can now be specified when using fitHeight.


  • Corrected spelling mistake

This awesome jQuery plugin is developed by benfoster. For more Advanced Usages, please check the demo page or visit the official website.