//# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // //# RESPONSIVEIFRAME (function($) { $.fn.responsiveIframe = function(config) { //: var defaults = {}; //: var options = $.extend({}, defaults, config); //: return this.each(function() { var $node = $(this); var $iframe = $node.find('iframe:not(.no-js)'); if ( $iframe.length > 0 ) { var containerWidth = $node.width(); var containerHeight = $node.height(); var windowEvent = isTouchDevice() ? 'orientationchange' : 'resize resizeend'; var iframeWidth = $iframe.attr('width'); var iframeHeight = $iframe.attr('height'); var isLechTv = $iframe.hasClass('lechTv'); if ( isLechTv ) { $node.addClass('responsivePlayer'); } else { $iframe.attr('width', '').attr('height', ''); var newWidth = containerWidth; var newHeight = Math.round( newWidth * (iframeHeight / iframeWidth) ); $iframe.attr('width', '100%').attr('height', newHeight); $(window).on(windowEvent, function(e) { var newWidth = $node.width(); var newHeight = Math.round( newWidth * (iframeHeight / iframeWidth) ); $iframe.attr('width', '100%').attr('height', newHeight); }); } // consoleLog( $iframe, ' | ', $node ); //: Test } }); }; })(jQuery);