jQuery Plugin For Simple Responsive iFrames - mediaWrapper.js

jQuery Plugin For Simple Responsive iFrames - mediaWrapper.js
File Size: 4.09 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

mediaWrapper.js is a minimalist jQuery plugin that makes your iFrame element responsive while keeping the aspect ratio by auto adjusting the height and width depending on the screen size and embedded content such as Youtube videos, webpages and Facebook widgets.

See also:

Basic usage:

1. To get started, you need to include both jQuery JavaScript library and the jQuery mediaWrapper.js plugin on your responsive webpage.

<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="jquery.mediaWrapper.js"></script>

2. To initialize mediaWrapper.js just call the mediaWrapper() on your iFrame element:

$('iframe.demo').mediaWrapper();

3. Here are several options you can pass as an object during initialization.

$('iframe.demo').mediaWrapper({

  // use the intrinsic width and height
  intrinsic   : true,

  // the aspect ratio of the content you are embedding
  baseWidth   : 16,
  baseHeight  : 9
  
});

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