Skip to content

Instantly share code, notes, and snippets.

@emailnjv
Created March 28, 2018 17:26
Show Gist options
  • Save emailnjv/85e958a6af32e940681070c3bfe7dfbb to your computer and use it in GitHub Desktop.
Save emailnjv/85e958a6af32e940681070c3bfe7dfbb to your computer and use it in GitHub Desktop.
Responsive iFrame through jQuery
jQuery(document).ready(function(){
var screenWidth = jQuery(window).width();
var videoWidth;
if (screenWidth < 770) {
if (screenWidth % 2 != 0) {
videoWidth = screenWidth - 1;
} else {
videoWidth = screenWidth;
}
videoHeight = videoWidth / 16 * 9;
}
jQuery("iframe.responsiveFrame").height(videoHeight).width(videoWidth);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment