rcerrejon
7/26/2016 - 3:04 PM

Responsive iFrame (video responsive)

Responsive iFrame (video responsive)

        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');
            }
        }