MyBB Community Forums

Full Version: Embedded Youtube/Videos on Smaller Layouts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to have embedded Youtube Videos scale with smaller windows or resolution. It seems to break the page

Preview:
http://puu.sh/e8frd/a39b3739f9.jpg
yes it is possible... first goto,

ACP >> Templates >> Your theme's Templates >> Video MyCode Templates >> video_youtube_embed

the width and height of the video is defined within the iframe and hence it remians constant... lets first remove those width and height add a css class instead...

change this....

<iframe width="560" height="315" src="http://www.youtube.com/embed/{$id}" frameborder="0" allowfullscreen></iframe>


to this....

<iframe class="yt" src="http://www.youtube.com/embed/{$id}" frameborder="0" allowfullscreen></iframe>


then goto global.css and these codes at the bottom...

@media screen and (max-width: 960px) {
iframe.yt {
width: 100%;
}
}

iframe.yt {
width: 560px;
height: 315px;
}


now, adjust the max-width as per your wish... save everything, open your forum and hard refresh it (CTRL+F5)...