Created
July 26, 2016 15:04
-
-
Save rcerrejon/022713eb61cd18fecb3310bab455fc84 to your computer and use it in GitHub Desktop.
Responsive iFrame (video responsive)
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
if ($('.vimeo-iframe').length > 0) { | |
oWindowWidth = $(window).outerWidth(); | |
oWindowHeight = $(window).outerHeight(); | |
windowWidth = $(window).outerWidth() - 10; | |
windowHeight = $(window).outerHeight() - 128; | |
wCalc = ((windowWidth * 100)/1280); | |
hCalc = ((windowHeight * 100)/720); | |
rwCalc = 1280 * (hCalc/100); | |
rhCalc = 720 * (wCalc/100); | |
if (oWindowWidth < 1280) { | |
$('.vimeo-iframe').attr('width', windowWidth + 'px'); | |
$('.vimeo-iframe').attr('height', rhCalc + 'px'); | |
} | |
if (oWindowHeight < 720) { | |
$('.vimeo-iframe').attr('height', windowHeight + 'px'); | |
$('.vimeo-iframe').attr('width', rwCalc + 'px'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment