Width set at 100% works perfectly. The problem is the height. Fixed pixel heights work up to a point on some devices but not all. For instance on a desktop at 1440x900, a full width video will usually be much higher than the 360px height mentioned in the media@ 1220 setting above.
Is there any way to have the height of the iframe calculated responsively based on what the iframe is determined to need to attain the 100% width?
Is there any way to have the height of the iframe calculated responsively based on what the iframe is determined to need to attain the 100% width?
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%;
}
OpenCart Still need more edit
@ 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%; }
This works for me without any need to add css (on the OC default theme)
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>
How can I add this to a specific page within information?
When I add this code to "information.twig", the embedded video shows up in all information pages.
<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>
When I add this code to "information.twig", the embedded video shows up in all information pages.
<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>
Who is online
Users browsing this forum: No registered users and 106 guests