Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Last active December 13, 2016 15:23
Show Gist options
  • Save brycejacobson/276abf361e5cf819c90c17fb8b88e203 to your computer and use it in GitHub Desktop.
Save brycejacobson/276abf361e5cf819c90c17fb8b88e203 to your computer and use it in GitHub Desktop.
Add flex-video class to embedded videos in WordPress
jQuery('iframe[src*="youtube.com"], iframe[src*="vimeo.com"]').each(function() {
if ( jQuery(this).innerWidth() / jQuery(this).innerHeight() > 1.5 ) {
jQuery(this).wrap("<div class='widescreen flex-video'/>");
} else {
jQuery(this).wrap("<div class='flex-video'/>");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment