Todd Stowell
asked 8 years ago

Is there a way with the theme to make youtube and embedded photos in a post responsive along with the design?

1 Answers
DominicStaff
answered 8 years ago

To resolve this problem, you can log in to Dashboard > Theme > Customize > add the following code in the “Header Script”


<script>
jQuery(document).ready(function($){
function responsiveIframe() {
// Fix responsive iframe
$('iframe').each(function(){
var iw = $(this).width();
var ih = $(this).height();
var ip = $(this).parent().width();
var ipw = ip/iw;
var ipwh = Math.round(ih*ipw);
$(this).css({
'width': ip,
'height' : ipwh,
});
});
}

responsiveIframe();

$(window).resize(function(){
responsiveIframe();
});
});
</script>

Hope this helps !
Regards,
Dominic

Powered by DW Question & Answer Pro