Re: Help making iframe embedded videos responsive
Posted: Sun Mar 13, 2016 6:18 am
I should be looking to use this in the future so well done on everyone that got this working
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Code: Select all
<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>
Code: Select all
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
@ Senseadv Awesome... it works perfect! Thanks for your post man!Senseadv wrote: ↑Sat Jun 04, 2016 3:47 pmCode: Select all
<div class="videoWrapper"> <!-- Copy & Pasted from YouTube --> <iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe> </div>
Code: Select all
.videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; } .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
Code: Select all
<div class="row">
<div class="col-xs-12 embed-responsive embed-responsive-16by9"><iframe src="URL_TO_VIDEO_OR_PLAYLIST" frameborder="0" allowfullscreen=""></iframe></div></div>