Code Monkey home page Code Monkey logo

mediawrapper.js's Introduction

mediaWrapper.js

Simple Responsive iframes.

jQuery mediaWrapper is a plugin for wrapping an making iframes and embedded videos behave more like images when developing a responsive website. Currently iframes will default to an arbitrary width set by the embed code.

The plugin is very simple, it wraps the iframe in a relatively positioned container, and absolutely positions the iframe inside of that container to conform to the container's dimensions. No styling is applied to the iframe or the container other than what is needed to make the iframe responsive.

You can apply your own styles to the iframe or it's container by targeting the 'mediaWrapper' class.

Usage

mediaWrapper accepts 3 options: intrinsic, baseHeight and baseWidth.

intrinsic: This option lets mediaWrapper use the intrinsic width and height attributes if they are set - this is good for sites that embed iframes of varying sizes. The default value is "true" - set it to "false" to use baseHeight & baseWidth.

baseHeight & baseWidth: These two options work together to determine the aspect ratio of the video you are embedding. You can use any combination of numbers, for example: an actual aspect ratio like '16 & 9' or '4 & 3' to set the aspect ratio, or a set of pixel values such as '640' & '480'. The plugin will fill 100% of it container's width by default. The default aspect ratio is 16:9.

$(document).ready(function(){
	$('iframe').mediaWrapper({
		intrinsic:	true,
		baseWidth	:16,
		baseHeight	:9
	});
});

Compatibility

This plugin has been tested in the following browsers:
Chrome: 26+
Firefox: 13+
Internet Explorer: 8+
Opera: 12+
Safari: 6+

License: MIT/GPLv2

mediawrapper.js's People

Contributors

akselkreis avatar jemware avatar

Stargazers

Matt avatar Ciro Urdaneta avatar Mikel Kew avatar Wesley Macente avatar Mészáros Róbert avatar  avatar  avatar  avatar Marc avatar Elon Zito avatar  avatar emawebdesign avatar Adrian Martinez avatar Tina Billinger avatar Alec Dionisio avatar TheCreation avatar Lek Tin avatar Denis Smet avatar Jérôme Coppée avatar Russel Porosky avatar Filipe Oliveira avatar Alexander Buch avatar Robbert van Mourik avatar Kaan ATA avatar Haris Pobric avatar Bill Gloff avatar David Panzarella avatar Artur Parkhisenko avatar Ryan Hudson-Peralta avatar Jason Martinez avatar  avatar Frederic Richard avatar Zach Abernathy avatar Radu Micu avatar Sorin avatar Ivan avatar Corey Benson avatar MARICHAL Emmanuel avatar Don Jones avatar o-l-e avatar Laove avatar Rev. Christopher Wulff avatar John avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar Andy Beckmann avatar  avatar

mediawrapper.js's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.