Last active
December 13, 2016 15:23
-
-
Save brycejacobson/276abf361e5cf819c90c17fb8b88e203 to your computer and use it in GitHub Desktop.
Add flex-video class to embedded videos in WordPress
This file contains hidden or 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
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