This is a nice piece of code I found in Stack Overflow, but I love the solution posted by Darwin in October 12 2012 and I tweaked to fit my needs and here is my code: function adjustVideoRatioToParent(arr){ var element = (arr.e === undefined)? jQuery(‘iframe[src*=”youtube”]’) : jQuery(arr.e); //set element or elements var eParent = element.parent(); […]