Auto-Resize iframe YouTube video on mobile

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
While I can embed a YouTube video in the item description, topic page, blog post, or news post, when it displays on a mobile phone, the iframe for the video doesn't resize to the width of the mobile device like I see happen on other websites.  

For example, I embed a YouTube video at a size of 800x480, for example, which looks fine as long as the browser size width is larger than 800px.  When displaying on a mobile device like an iPhone, the video iframe doesn't resize to the width of the mobile version of the site.  

I hope that all makes sense.  Anyone know how to accomplish this auto-resize of the iframe for YouTube videos on mobile?

Using nopCommerce 3.80, default theme.  

-Fred
7 years ago
Hi,

look this page

https://www.tuttocialde.it/pubblicita-sky

in particular

css
.videowrapper {
    float: none;
    clear: both;
    width: 90%;
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 25px;
    height: 0;
    margin: auto;
}

I hope this help you!
7 years ago
Thank you.  I figured it out using a similar method.  The videocontainer is a div class and the videowrapper is the iframe class.



.videocontainer {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
}
.videowrapper {
position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  border:1px solid #333;
}



<div class="videocontainer"><iframe class="videowrapper"></iframe></div>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.