Log in

View Full Version : responsive 2 columns with youtube video problem



mlegg
03-20-2015, 11:34 PM
On this page (http://www.pscompetitiveedge.com/references.html) I have 2 youtube videos side by side in columns. It appears fine when I look at it full screen.

5640

When I have a smaller screen, the images are right into each other sideways, and when it's mobile sized, the videos hang out of the container.

5641

html for that part

<div class="section group">
<div class="col span_1_of_2">
<iframe width="450" height="363" src="https://www.youtube.com/embed/aaINOaWt938?rel=0?" frameborder="0" allowfullscreen></iframe>
<p>Click Above To View Testimonial Video!</p>
</div>
<div class="col span_1_of_2">
<iframe width="450" height="363" src="https://www.youtube.com/embed/e6UWqeLaMm4?rel=0?" frameborder="0" allowfullscreen></iframe>
<p>Click to see Peter in seminar action!</p>
</div></div>
<div style="clear:both"></div>

Css for that part

/* SECTIONS */
.section {
clear: both;
padding: 0px;
margin: 0px;
}

/* COLUMN SETUP */
.col {
display: block;
float:left;
margin: 1% 0 1% 1.5%;
}
.col:first-child { margin-left: 0; }


/* GROUPING */
.group:before,
.group:after {
content:"";
display:table;
}
.group:after {
clear:both;
}
.group {
zoom:1; /* For IE 6/7 */
}



/* GRID OF TWO */
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 49.25%;
}

/* GO FULL WIDTH AT LESS THAN 480 PIXELS */

@media only screen and (max-width: 480px) {
.col {
margin: 1% 0 1% 0%;
}
}

@media only screen and (max-width: 480px) {
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 100%;
}
}

mlegg
03-20-2015, 11:36 PM
the bottom part of the page I will be fixing later on with a responsive image grid that Beverly linked me to

Beverleyh
03-21-2015, 06:13 AM
https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php

The part you need is;
<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>

.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%;
}

mlegg
03-21-2015, 01:28 PM
That does make them responsive! It makes the videos full sized on top on each other. How can I make it do that the videos are side by side? with space between them

this is the html I used

<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="450" height="363" src="https://www.youtube.com/embed/aaINOaWt938?rel=0?" frameborder="0" allowfullscreen></iframe>
<p>Click Above To View Testimonial Video!</p>
</div>
<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="450" height="363" src="https://www.youtube.com/embed/e6UWqeLaMm4?rel=0?" frameborder="0" allowfullscreen></iframe>
<p>Click to see Peter in seminar action!</p>
</div>
<div style="clear:both"></div>

I used the css above that you posted.
thank you so much for helping

Beverleyh
03-21-2015, 02:38 PM
Where are the markup classes for your grid system? You seem to have totally removed them and switched to the standalone fluid videoWrapper markup (which will default to 100% width because divs are block level elements).

Remember that you need extra layout markup to create the 2-column layout. The responsive video markup and CSS is just for videos within responsive design. The layout would be extra.

I'm not sure what grid system you're using but here's a simplified demo http://fofwebdesign.co.uk/template/_testing/rwd-videos.htm

mlegg
03-21-2015, 05:53 PM
I forgot the grid system. I just uploaded again. It makes the 2 videos on top of each other (from left to right) when the screen goes smaller. When it's small they are on top of each other properly but in both cases the video hangs over the right out of the container again.
look here at uploaded working page (http://www.pscompetitiveedge.com/references.html)

Beverleyh
03-21-2015, 06:31 PM
I'm on iPhone at the mo and can't see how you're CSS is being applied. I can view your source code though and there is a styles-test.css file throwing up a 404 error. Is your CSS there and not being applied to the page?

I also see a styles.css file with CSS for .Flexible-container iframe (the same as the videoWrapper stuff) However, I can't see a container anywhere in your markup with the ".Flexible-container" class applied.

So at this stage it looks like the pertinent CSS isn't being applied to the videos (wrong classes).

To confirm;

- you have the relevant flexible video CSS in the "styles.css" file, defined under ".Flexible-container", but the class doesn't appear to be used in your markup.

- you have ".videoWrapper" in your HTML markup, but you don't have it defined in the "styles.css" stylesheet

Maybe you can use a simpler "grid system" like in this demo http://fofwebdesign.co.uk/template/_testing/rwd-videos.htm

mlegg
03-21-2015, 06:52 PM
It's working now. I re-uploaded the styles.css again and then refreshed the page and css cache. It works now. :D

this is the entire css file (http://www.pscompetitiveedge.com/styles.css)

Now, I'm off to work on changing all the images using the responsive grid system you showed me earlier this week.


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<title>CSS3 Grid Images - Fluid Scale, Responsive</title>
<!-- http://www.dynamicdrive.com/forums/archive/index.php/t-77355.html -->

<style>
html, body { margin:0; padding:0; font:16px/1.75 Verdana, Arial, Helvetica, sans-serif; background:#ccc }
#header { position:relative; top:0; left:0; right:0; height:4.0625em; background:#222 }
.page-content { padding:1em; max-width:64em; margin:auto; background:#fff }
table { margin:1em 0 }
td { font-weight:bold }
td, input { text-align:center }
.right { text-align:right }
.left { text-align:left }
.clearfix:after { content:" "; display:table; clear:both }


.img-01 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Truly Outrageous Jem.jpg') }
.img-02 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Zazz & Roxy.JPG') }
.img-03 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - double vision.JPG') }
.img-04 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Rio and Rio.jpg') }
.img-05 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Now.JPG') }
.img-06 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Roxy GGGRRRRR.jpg') }
.img-07 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - those pants - back.jpg') }
.img-08 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - those pants - front.jpg') }
.img-09 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Minx Rio & Jem again.jpg') }
.img-10 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Minx saunters.jpg') }
.img-11 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - One Pizzazz Too Many.jpg') }
.img-12 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - loves young dream.jpg') }
.img-13 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - down with the 80s.JPG') }
.img-14 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - he is mine Jem.jpg') }
.img-15 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - mini Misfits.jpg') }
.img-16 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - nasty Jetta & Roxy.jpg') }
.img-17 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - sexy Pizzazz!.jpg') }
.img-18 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - sexy Roxy.jpg') }
.img-19 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Mr Jem Pants & Jetta.JPG') }
.img-20 { background-image:url('/freebies-for-websites/php/gallery/small/Cosplay - Mr Jem Pants!.jpg') }

/* #### - reduce padding-bottom for rectangular images (75% = 4:3 aspect ratio, 56.25% = 16:9 aspect ratio) - #### */
.img { padding-bottom:100%; width:100%; background-position:center; background-repeat:no-repeat; background-size:cover }
.img:hover { opacity:0.5 }

/* #### - smallest width = 2 images per row - #### */
.grid-outer { margin:-3% } /* negative value of .grid margin */
.grid { float:left; margin:3%; width:44% } /* width = (100 / images per row) - ( margin x 2 ) */

@media ( min-width:20em ) { /* #### - > 320px = 3 images per row - #### */
.grid-outer { margin:-2% } /* negative value of .grid margin */
.grid { margin:2%; width:29.333% } /* width = (100 / images per row) - ( margin x 2 ) */
}

@media ( min-width:35em ) { /* #### - > 560px = 4 images per row - #### */
.grid-outer { margin:-1.5% } /* negative value of .grid margin */
.grid { margin:1.5%; width:22% } /* width = (100 / images per row) - ( margin x 2 ) */
}

@media ( min-width:50em ) { /* #### - > 800px = 5 images per row - #### */
.grid-outer { margin:-1% } /* negative value of .grid margin */
.grid { margin:1%; width:18% } /* width = (100 / images per row) - ( margin x 2 ) */
}
</style>

<!--[if lt IE 9]>
<style>
.grid-outer { margin:-1% }
.grid { width:125px; margin:1% }
.img { height:125px; padding-bottom:0 }
.clearfix { *zoom:1 }
</style>
<![endif]-->

</head>
<body>

<div id="header">
<a href="/"><img src="/template/images/logo-50x50.png" style="position:absolute; top:0.5em; left:1em; width:3em; height:3em; border:0" alt="Home" title="Home"/></a>
<span style="position:absolute; top:1.175em; left:5em; color:#fff">Focus on Function</span>
</div><!-- closing "#header" -->

<div class="page-content">

<h2>CSS3 Grid Images - Fluid Scale, Responsive</h2>
<p>The images in this demo fluidly scale down in size as the browser width decreases. They do not break out of their grid.</p>
<br/>

<div class="grid-outer clearfix">
<div class="grid">
<div class="img img-01"></div>
</div>
<div class="grid">
<div class="img img-02"></div>
</div>
<div class="grid">
<div class="img img-03"></div>
</div>
<div class="grid">
<div class="img img-04"></div>
</div>
<div class="grid">
<div class="img img-05"></div>
</div>
<div class="grid">
<div class="img img-06"></div>
</div>
<div class="grid">
<div class="img img-07"></div>
</div>
<div class="grid">
<div class="img img-08"></div>
</div>
<div class="grid">
<div class="img img-09"></div>
</div>
<div class="grid">
<div class="img img-10"></div>
</div>
<div class="grid">
<div class="img img-11"></div>
</div>
<div class="grid">
<div class="img img-12"></div>
</div>
<div class="grid">
<div class="img img-13"></div>
</div>
<div class="grid">
<div class="img img-14"></div>
</div>
<div class="grid">
<div class="img img-15"></div>
</div>
<div class="grid">
<div class="img img-16"></div>
</div>
<div class="grid">
<div class="img img-17"></div>
</div>
<div class="grid">
<div class="img img-18"></div>
</div>
<div class="grid">
<div class="img img-19"></div>
</div>
<div class="grid">
<div class="img img-20"></div>
</div>
</div>
<br/>


<h2>Compatibility</h2>
<ul>
<li>IE9+ *</li>
<li>Chrome</li>
<li>Safari</li>
<li>Firefox</li>
<li>Opera</li>
<li>Android</li>
<li>iOS</li>
</ul>
<p>* "background-size:cover;" isn't supported in IE7/8 so a fixed-size fallback is provided for those browsers.</p>

<div id="calc">
<h2>Grid Image Calculator</h2>
<p>This form calculates the required <b>width</b> CSS value of each image in a row, for this demo's fluid grid scaling.</p>
<p>Enter the desired number of images per row, the margin around images, then transfer the results to your CSS.</p>
<table>
<tr>
<td>&nbsp;</td>
<td>images per row</td>
<td>margin (%)</td>
</tr><tr>
<td class="right"> </td>
<td><input type="text" id="ipr" /></td>
<td><input type="text" id="mar" /></td>
</tr><tr>
<td>&nbsp;</td>
<td colspan="2"><input type="submit" onclick="Calculate();" value="CALCULATE"/></td>
</tr><tr>
<td class="right">width: </td>
<td><input type="text" id="wth" /></td>
<td class="left">% (per image)</td>
</tr>
</table>
</div>

&nbsp;
</div><!-- closing ".page-content" -->

<script>
function roundNumber(number, digits) {
var multiple = Math.pow(10, digits);
var rndedNum = Math.round(number * multiple) / multiple;
return rndedNum;
}
function Calculate() {
var ipr = document.getElementById('ipr').value;
var mar = document.getElementById('mar').value;
var wth = (100 / ipr) - (mar * 2);
document.getElementById('wth').value = roundNumber(parseFloat(wth), 3);
localStorage.setItem('ipr', ipr.value);
localStorage.setItem('mar', mar.value);
}
</script>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
/* })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); */
})(window,document,'script','//fofwebdesign.co.uk/template/scripts/ga.php','ga');
ga('create', 'UA-33863475-1', 'fofwebdesign.co.uk');
ga('send', 'pageview');
</script>

</body>
</html>

Beverleyh
03-21-2015, 07:53 PM
Looks good. It's coming along very nicely :)

mlegg
03-25-2015, 11:42 PM
The videos are responsive but not side by side. I must have changed something without making a backup. Here is the test page with the videos (http://www.pscompetitiveedge.com/references-test.html)

CSS

body {
width:100%;
margin:0;
color: #000000;
background-color:#191919;
font-family:'Open Sans',sans-serif;
font-size:18px;
}
#container {
width:90%;
margin:auto;
background-color:#ffffff;
font-family : sans-serif;
color : #000000;
font-size: 18px;
}
img {
max-width: 100%;
height: auto;
}
#logo {
display:block;
width:100%;
}
#content {
color: #000000;
clear:both;
position:relative;
padding:1.5em 5%;
font-size: 18px;
}
ul {
padding:0;
margin:0;
list-style-type:none;
}
a {
text-decoration:none;
}
#vlb1overlay {z-index:100 !important;}
.arrow-down {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;

border-top: 20px solid #000;
}
h1 {
color:#FF0000;
clear:both;
text-align:center;
}
h2 {
color:#FF0000;
clear:both;
text-align:center;
}
h3 {
color:#FF0000;
clear:both;
text-align:center;
}
#Intro {
font-size: 20px;
color:#FF0000;
font-style: italic;
clear:both;
}
#Sig {
font-family:Brush Script MT;
color:#FF0000;
font-size:1.6em;
clear:both;
}
audio {
visibility:hidden;
height:0;
width:0;
}
#pauseplay {
float:right;
width:32px;
height:32px;
cursor:pointer;
}

.innerBox {
background-color : #ffffff;
background-repeat : repeat-y;
padding-top: 1em;
padding-left: 1em;
padding-right: 1em;
padding-bottom : 1em;
}
.vid-content { padding:1em; max-width:64em; margin:auto }

.videoWrapper { position:relative; padding-bottom:56.25%; padding-top:25px; height:0 }
.videoWrapper iframe { position:absolute; top:0; left:0; width:100%; height: 100% }
.col, .col * { box-sizing:border-box }
.col { padding:2% 0 }

@media ( min-width:35em ) { /* #### - > 560px (560 / 16 = 35) - 16px being default browser font-size - #### */
.col { width:50%; padding:2% }
.col-1 { float:left }
.col-2 { float:right }
}
.quotes { position:relative; max-width:80em; list-style-type:none; text-align:center; margin:0 auto; padding:0 }
.quotes li { position:absolute; left:0; right:0; background:#ddd; text-align:center; padding:1em; border-radius:0.25em; opacity:0 }
.quotes span { display:block; text-align:right; margin-right:5%; margin-top:1em; font-size:80%; font-style:italic; color:#999 }
.quotes li:after { /* quote triangle */
position:absolute; content:""; display:block; width:0; height:0;
border-left:0.75em solid transparent;
border-right:0.75em solid transparent;
border-top:0.75em solid #ddd;
bottom:-0.75em;
left:2em
}
.quotes .show { position:relative; -webkit-animation:quote 5s infinite; animation:quote 5s infinite } /* animation lasts 5 secs */
@-webkit-keyframes quote {
0% { opacity:0 }
25% { opacity:1 }
75% { opacity:1 }
100% { opacity:0 }
}
@keyframes quote {
0% { opacity:0 }
25% { opacity:1 }
75% { opacity:1 }
100% { opacity:0 }
}

#left {
float: left;
width: 32%;
padding:5px;
}

#middle {
float: left;
width: 32%;
padding:5px;
}

#right {
float:left;
width:32%;
padding:5px;
}

.columns {
width:100%;
}
.left{
float:left;
width:48%;
}
.right {
width:48%;
}
.clear {
clear:both;
}
/* Flexible iFrame */

.Flexible-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}

.Flexible-container iframe,
.Flexible-container object,
.Flexible-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

/* SECTIONS */
.section {
clear: both;
padding: 0px;
margin: 0px;
}

/* COLUMN SETUP */
.col {
display: block;
float:left;
margin: 1% 0 1% 1.5%;
}
.col:first-child { margin-left: 0; }


/* GROUPING */
.group:before,
.group:after {
content:"";
display:table;
}
.group:after {
clear:both;
}
.group {
zoom:1; /* For IE 6/7 */
}



/* GRID OF TWO */
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 49.25%;
}

/* GO FULL WIDTH AT LESS THAN 480 PIXELS */

@media only screen and (max-width: 480px) {
.col {
margin: 1% 0 1% 0%;
}
}

@media only screen and (max-width: 480px) {
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 100%;
}
}

#footer {
background:#E45E17;
width:90%;
height: auto;
margin:auto;
text-align:center;
font-family:sans-serif;
font-size:16px;
color:#010101;
padding:0.5em 0;
}
#footer a:link {
color : #000000;
text-decoration : underline;
}
#footer a:visited {
color : #000000;
text-decoration : underline;
}
#footer a:hover {
color : #000000;
background-color : #E45E17;
text-decoration : underline;
}
#footer a:active {
color : #000000;
background-color : #FFFFFF;
text-decoration : underline;
}

/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

The HTML is too long to post.

Beverleyh
03-26-2015, 09:00 AM
I'm looking at your page here: http://www.pscompetitiveedge.com/references.html because its easier to troubleshoot in a live page, and make live edits with the help of the Developer Toolbar that comes bundled with all popular browsers.

You can do the same - To open the Developer Toolbar, hit F12 and click on the element to inspect (or, depending on browser, right-click into the browser window and choose 'inspect element' from the context menu), then you can fine-tune the applied styles on the right until elements behave as you'd expect.

Looking at your page (http://www.pscompetitiveedge.com/references.html) logically, try to consider what effect each style definition is having on the element while you make your changes.

TIP: If 'A' is 50% wide and it is inside 'B' that is also 50% wide, 'A' will actually be 25% wide overall.

So have a think about what applied styles you need to disable to make the videos 50% :)

mlegg
03-26-2015, 01:48 PM
I can't figure it out. I may just switch the videos to images and link the image to the video.

Beverleyh
03-26-2015, 01:54 PM
The quickest fix would be to remove the "left" and "right" classes here;


<div class="columns">
<div class="left"><div class="col col-1 clear">
<div class="videoWrapper">
<iframe width="450" height="363" src="https://www.youtube.com/embed/aaINOaWt938?rel=0?" frameborder="0" allowfullscreen></iframe></div>
<p>Click Above To View Testimonial Video!</p></div></div>
<div class="right"><div class="col col-2">
<div class="videoWrapper">
<iframe width="450" height="363" src="https://www.youtube.com/embed/e6UWqeLaMm4?rel=0?" frameborder="0" allowfullscreen></iframe></div>
<p>Click Above To View Peter In Seminar Action!</p></div></div>


But this introduces a glitch with floats and the videos butting up against the circular music icon above, so they also need to be cleared. You can do that by using one of your existing classes in the "col-1" div. I've added that in blue so you can see where it goes.

So to summarise, remove the classes in red, and added the class in blue.

Does that solve it?

mlegg
03-26-2015, 02:18 PM
unfortunately that didn't work, I think I will go back to how it was with images that link to the videos and use the grid system for the whole page.
I'll let you know how that worked out. Thank you

molendijk
03-26-2015, 09:08 PM
Something like this,perhaps?

<div style="position: relative; max-width:450px; width: 40%; height:40%; max-height: 363px; float: left; margin-left: 5%">
<iframe style="position: relative; width:100%; height:100%; " src="https://www.youtube.com/embed/aaINOaWt938?rel=0?" frameborder="0" allowfullscreen></iframe><br>
<div style="text-align: center">Click Above To View Testimonial Video!</div>
</div>

<div style="position: relative; max-width:450px; width: 40%; height:40%; max-height: 363px; float: right; margin-right: 5%">
<iframe style="position: relative; width:100%; height:100%; " src="https://www.youtube.com/embed/e6UWqeLaMm4?rel=0?" frameborder="0" allowfullscreen></iframe>
<div style="text-align: center">Click to see Peter in seminar action!</div>
</div>

<div style="clear:both"></div>

mlegg
03-26-2015, 09:42 PM
That works to keeep them side by side but the height is not proportionate to the ratio of the video. The width is fine but the height is too short.

live page with your code (http://www.pscompetitiveedge.com/references.html)

5648

Beverleyh
03-26-2015, 10:25 PM
unfortunately that didn't work, I think I will go back to how it was with images that link to the videos and use the grid system for the whole page.
I'll let you know how that worked out. Thank youi think the confusion stems from trying to mix your existing grid system with my working demo here http://fofwebdesign.co.uk/template/_testing/rwd-videos.htm (although when I tested here - the red/blue class changes - it worked fine)

Try copying and pasting from my demo again but without trying to combine it with any other containers. Just paste the exact markup into your main outer container (not inside any other columns) and add the css to the bottom of your stylesheet.

molendijk
03-26-2015, 11:25 PM
Try this. It works for me. It's a combination of YouTube-thumbnails and jquery

<!doctype html>
<html >
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>

<title>&nbsp;</title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<div style="position: relative; max-width:450px; width: 40%; max-height: 363px; float: left; margin-left: 5%; background: black">
<img id="yt_thumb_left" src="http://img.youtube.com/vi/aaINOaWt938/hqdefault.jpg" alt="" style="position: absolute; width: 100%; border: 1px solid black; " >
<iframe id="left_frame" name="left_frame" src=null frameborder="0" allowfullscreen style="width: 100%; height: 100%"></iframe>
<div style="text-align: center; background: white">
<button style="cursor: pointer" onclick="frames.left_frame.location.replace('https://www.youtube.com/embed/aaINOaWt938?autoplay=1&rel=0'); document.getElementById('yt_thumb_left').style.visibility='hidden'">Play</button>
<button style="cursor: pointer" onclick="frames.left_frame.location.replace(null); document.getElementById('yt_thumb_left').style.visibility='visible'">Stop</button>
</div>
</div>


<div style="position: relative; max-width:450px; width: 40%; max-height: 363px; float: right; margin-right: 5%; background: black">
<img id="yt_thumb_right" src="http://img.youtube.com/vi/e6UWqeLaMm4/hqdefault.jpg" alt="" style="position: absolute; width: 100%; border: 1px solid black; ">
<iframe id="right_frame" name="right_frame" src=null frameborder="0" allowfullscreen style="width: 100%; height: 100%"></iframe>
<div style="text-align: center; background: white">
<button style="cursor: pointer" onclick="frames.right_frame.location.replace('https://www.youtube.com/embed/e6UWqeLaMm4?autoplay=1&rel=0'); document.getElementById('yt_thumb_right').style.visibility='hidden'">Play</button>
<button style="cursor: pointer" onclick="frames.right_frame.location.replace(null); document.getElementById('yt_thumb_right').style.visibility='visible'">Stop</button>
</div>
</div>

<div style="clear:both"></div>


<!-- This script must be put immediately before the closing body tag -->
<script>
function resize_frame()
{
document.getElementById('left_frame').style.height=$('#yt_thumb_left').height()+'px';
document.getElementById('left_frame').style.width=$('#yt_thumb_left').width()+'px';

document.getElementById('right_frame').style.height=$('#yt_thumb_left').height()+'px';
document.getElementById('right_frame').style.width=$('#yt_thumb_left').width()+'px';
}
resize_frame();
window.onresize=function(){resize_frame()}
</script>

</body>

</html>

molendijk
03-26-2015, 11:37 PM
No offense, but may I add that this Peter Scott, given his age, should have reached a certain level of modesty and wisdom instead of acting like an adolescent shouting and yelling around? I'm really astonished about this.

mlegg
03-27-2015, 12:26 AM
I know, I asked him about that but he says that in the casinos that they almost have to tell to be heard.

The side by side responsive videos work the way you coded it:
http://www.pscompetitiveedge.com/rwd2vids.html

One thing, the video on the left is a bit higher than the one on the right. It's more noticeable when the page is scaled down.

5649

Lastly, I ran the code through a validator. The nav menu code doesn't quite validate but it works. Also, at the bottom of the page, there is a black space under the content and above the footer. I've tried adding a </div> or 2 and deleting a </div> or 2 but can't quite get it to work properly

5650

mlegg
03-27-2015, 12:32 AM
the HTML is too long to post, so here it is in the attachment

molendijk
03-27-2015, 12:47 AM
On small screens, the video on the left is a bit higher than the one on the right because of pause.png. You should give that image an absolute position.

The page I gave you validates except for autoplay=1&rel=0 and frameborder="0". That's no issue at all. If you want the page to validate, replace & with &amp; and remove frameborder="0". Your own online page, on the other hand, has many validation errors. Try to fix it.

The black space above the footer has nothing to do with my code. That's another subject.

Beverleyh
03-27-2015, 08:48 AM
This works fine - http://fofwebdesign.co.uk/template/_testing/mlegg/rwd2vids.htm - the only thing I did was;

- return my markup to the web page
- move the video CSS to the bottom of your stylesheet
- put the .vid-content in the HTML markup (you had it in the stylesheet but not in the HTML)
- add greater specificity to the CSS with the .vid-content selector
- fine-tuning: override 2 definitions (margin and float) from elsewhere (but only for the .vid-content container)

CSS
.vid-content { padding:1em; max-width:64em; margin:auto }
.videoWrapper { position:relative; padding-bottom:56.25%; padding-top:25px; height:0 }
.videoWrapper iframe { position:absolute; top:0; left:0; width:100%; height: 100% }
.vid-content .col, .vid-content .col * { box-sizing:border-box }
.vid-content .col { padding:2% 0; margin:0; float:none }

@media ( min-width:35em ) { /* #### - > 560px (560 / 16 = 35) - 16px being default browser font-size - #### */
.vid-content .col { width:50%; padding:2% }
.vid-content .col-1 { float:left }
.vid-content .col-2 { float:right }
}

HTML
<div class="vid-content">
<div class="col col-1 clear">
<div class="videoWrapper">
<iframe width="450" height="363" src="https://www.youtube.com/embed/aaINOaWt938?rel=0?" frameborder="0" allowfullscreen></iframe>
</div>
<p>Click Above To View Testimonial Video!</p>
</div>
<div class="col col-2">
<div class="videoWrapper">
<iframe width="450" height="363" src="https://www.youtube.com/embed/e6UWqeLaMm4?rel=0?" frameborder="0" allowfullscreen></iframe>
</div>
<p>Click Above To View Peter In Seminar Action!</p>
</div>
</div>
ps - to stop the video on the left being a little higher, you can clear it with the .clear class already in your stylesheet as per my previous suggestion here: http://www.dynamicdrive.com/forums/showthread.php?78112-responsive-2-columns-with-youtube-video-problem&p=311620#post311620 (I've put that back into the markup in blue)

Beverleyh
03-27-2015, 09:55 AM
I know, I asked him about that but he says that in the casinos that they almost have to tell to be heard.

The side by side responsive videos work the way you coded it:
http://www.pscompetitiveedge.com/rwd2vids.html

One thing, the video on the left is a bit higher than the one on the right. It's more noticeable when the page is scaled down.

5649

Lastly, I ran the code through a validator. The nav menu code doesn't quite validate but it works. Also, at the bottom of the page, there is a black space under the content and above the footer. I've tried adding a </div> or 2 and deleting a </div> or 2 but can't quite get it to work properly

5650

Not sure about other devices, but here's how this method looks and behaves on iPhone 5S http://fofwebdesign.co.uk/template/_testing/mlegg/jquery-thumb.mov

Beverleyh
03-27-2015, 10:03 AM
And a comparison iPhone 5S video for the alternative method: http://fofwebdesign.co.uk/template/_testing/mlegg/jquery-thumb-bev.mov

Both methods tested in Safari, Chrome and Mercury browsers - same behaviour as the videos show.

mlegg
03-27-2015, 04:57 PM
That worked great for the videos Bev. I still cannot figure out what div is open or an extra closed to leave a space between the white content and the orange footer.
I can't wait until I'm done with this project. :rolleyes:

Beverleyh
03-27-2015, 06:50 PM
That would be courtesy of this line here;
<p style="text-align:center">Call For Your Complimentary Consultation (520) 977-5695</p>

<p> tags have default margins that are pushing the divs either side apart - hence the black gap. If you zero the margin, the gap will close;
<p style="text-align:center; margin:0">Call For Your Complimentary Consultation (520) 977-5695</p>

If you need extra space once that is set, try putting on some padding (padding creates space internally, margin creates space externally) :)

mlegg
03-27-2015, 07:03 PM
Thanks I didn't realize that, obviously :P