Last active
August 29, 2015 14:24
-
-
Save donaldG/f8b3547d930febdaabb6 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
<script> | |
jQuery(document).ready(function($) { | |
$('iframe[src*="youtube.com"]').wrapAll('<div class="youtube-wrapper">'); | |
$('.youtube-wrapper').wrapAll('<div class="video-player">'); | |
}); | |
</script> | |
<style> | |
.video-player { | |
clear: both; | |
width: 100%; | |
margin: 0 0 1em; | |
overflow: hidden; | |
} | |
.video-player .youtube-wrapper { | |
position: relative; | |
width: 100%; | |
height: 0; | |
margin: 0 auto 1em; | |
padding-bottom: 56.27%; | |
} | |
.video-player iframe{ | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment