Created
December 11, 2017 21:13
-
-
Save ms-studio/9b01535311a83a49dd7ca28a1f45930c to your computer and use it in GitHub Desktop.
vimeo-responsive-embed.js
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
$(".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