Post by cyclops12 » 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

Active Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by giproc » Sun May 29, 2016 10:03 pm

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?

New member

Posts

Joined
Sat Aug 29, 2015 9:24 pm

Post by Senseadv » Sat Jun 04, 2016 3:47 pm

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


User avatar
Newbie

Posts

Joined
Sat Jun 04, 2016 3:35 pm

Post by cepcemuh » Thu Apr 13, 2017 1:45 am

Senseadv wrote:
Sat Jun 04, 2016 3:47 pm

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!

Newbie

Posts

Joined
Sat Jan 21, 2017 5:15 pm

Post by uksitebuilder » Thu Apr 13, 2017 2:57 pm

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>

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by AD02143 » Tue Feb 13, 2018 9:07 am

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>

Newbie

Posts

Joined
Fri Oct 27, 2017 2:22 pm
Who is online

Users browsing this forum: No registered users and 6 guests