Skip to content

Instantly share code, notes, and snippets.

@ms-studio
Created December 11, 2017 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ms-studio/9b01535311a83a49dd7ca28a1f45930c to your computer and use it in GitHub Desktop.
Save ms-studio/9b01535311a83a49dd7ca28a1f45930c to your computer and use it in GitHub Desktop.
vimeo-responsive-embed.js
$(".entry-content > p > iframe").each(function() {
var $this = $(this);
// donner classe video-gallery-item au parent
$this.parent().addClass('video-gallery-item');
// corriger le ratio
var videoWidth = $this.attr('width');
var videoHeight = $this.attr('height');
var videoRatio = 100*(videoHeight / videoWidth);
$this.parent().css( "padding-bottom", videoRatio+"%" );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment