Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created June 20, 2014 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/0bc85c87740876e9aa09 to your computer and use it in GitHub Desktop.
Save tmcw/0bc85c87740876e9aa09 to your computer and use it in GitHub Desktop.
function initVideos() {
var videos = $('iframe, video');
// Figure out and save aspect ratio for each video
videos.each(function() {
$(this).data('aspectRatio', this.width / this.height)
// and remove the hard coded width/height
.removeAttr('height')
.removeAttr('width');
});
// Firefox Opacity Video Hack
$('iframe').each(function(){
var url = $(this).attr("src");
if ( !empty(url) )
$(this).attr("src", setQueryParameter(url, "wmode", "transparent"));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment