Created
November 7, 2011 23:09
-
-
Save chriscoyier/1346492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$allVideos.each(function(){ | |
var $this = $(this); | |
if (this.tagName == 'embed' && $this.parent('object').length) { return; } | |
var height = this.tagName == 'OBJECT' ? $this.attr('height') : $this.height(), | |
aspectRatio = height / $this.width(); | |
$this.wrap('<div class="fluid-width-video-wrapper" />').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); | |
$this.removeAttr('height').removeAttr('width'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment