Skip to content

Instantly share code, notes, and snippets.

@eboyer
Created November 5, 2013 23:30
Show Gist options
  • Save eboyer/7328252 to your computer and use it in GitHub Desktop.
Save eboyer/7328252 to your computer and use it in GitHub Desktop.
Responsive Video
responsiveVideosSetup: function(){
var that = this;
var iframeElement = that.ui.heroWrapper.find('iframe');
var videoRatio = (iframeElement.height() / iframeElement.width()) * 100;
iframeElement.css({
'position':'absolute',
'top':0,
'left':0,
'width':'100%',
'height':'100%'
});
var ghost = $('<div></div>');
ghost.addClass('fluidvids');
ghost.css({
'width':'100%',
'position':'relative',
'padding-top':videoRatio + '%'
});
var thisParent = iframeElement.parent();
thisParent.prepend(ghost);
ghost.append(iframeElement);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment