Skip to content

Instantly share code, notes, and snippets.



Last active Mar 4, 2020
What would you like to do?
make vimeo embeds responsive
// Responsive Vimeo Embed:
var $allVideos = $("iframe[src^='//']");
$allVideos.each(function() {
.data('aspectRatio', this.height / this.width)
$(window).resize(function() {
$allVideos.each(function() {
var $el = $(this);
$el.width( $(this).parent().width() ).height( $(this).parent().width() * $'aspectRatio'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment