Vue.js rendering issue, responsive iframes - iframe

I am trying to pull some videos from Vimeo with Vue and the component markup is this:
<div class="vimeo-data">
<div class="video-wrap" v-for="video in videos" v-bind:key="video.name">
<h2>{{video.name}}</h2>
<figure v-html="video.embed.html" class="video-container"></figure>
</div>
</div>
In my understanding, this should generate a HTML similar to this (which it does).
<div class="vimeo-data">
<div class="video-wrap">
<h2>The video name</h2>
<figure v-html="video.embed.html" class="video-container">
<iframe src="https://player.vimeo.com/video/249865075?title=0&byline=0&portrait=0&badge=0&autopause=0&player_id=0" width="1920" height="810" frameborder="0" title="Academia Titi Aur - Macadam" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</figure>
</div>
<div class="video-wrap">
<h2>Another video name</h2>
<figure class="video-container">
<iframe allowFullScreen frameborder="0" width="100%" height="564" mozallowfullscreen src="https://player.vimeo.com/video/249865062" webkitAllowFullScreen></iframe>
</figure>
</div>
<div class="video-wrap" >
<h2>Some video name</h2>
<figure class="video-container">
<iframe src="https://player.vimeo.com/video/249226102?title=0&byline=0&portrait=0&badge=0&autopause=0&player_id=0" width="1920" height="1080" frameborder="0" title="6 PLIN intro" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</figure>
</div>
</div>
I made a test and created a static html page with what is being generated by Vue and although the css is the same (below) the videos in the static html are nice and responsive (https://jsfiddle.net/4q5Lyn97/) while the ones generated by Vue are not responsive, they seem cut - see the image below.
.vimeo-data {
position: relative;
top: 70px;
}
embed,
iframe,
object {
max-width: 100%;
}
.video-wrap {
padding-top: 2em;
max-width: 98%;
margin: 10px auto;
clear: both;
}
.video-container {
position: relative;
padding-bottom: 42.18%;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
What can be the cause of this behavior?

Related

Youtube iframe responsive and float left

I need to make a youtube iframe responsive and also that the iframe is left floating to add content to the right, I tried with this code but the iframe is not responsive?
Thanks.
The JSFiddle : http://jsfiddle.net/94150148/vh04d7y2/
.videoWrapper {
position: relative;
padding-bottom: 51.44%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.box1 {
float:left;
width: 400px
}
<div class="box1">
<div class="videoWrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/6apL89xgbR0"
frameborder="0" allowfullscreen></iframe></div></div>
<div class="box2">Some text</div>
I will suggest to use Bootstrap for making embedded videos responsive which are added through iframe, following is the code which you can use to make the iframe responsive
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
But make sure to add bootstrap.css and and other bootstrap dependencies.
All you need is max-width:
.left {max-width: 400px;}

Bootstrap and text on responsive image

I am trying to accomplish something like this:
As I am using Bootstrap, for now I have this:
<div class="col-md-3">
<div class="test">
<%= (image_tag("http://example.com.image.jpg", :class => "img-responsive")) %>
<h2>hello</h2>
</div>
</div>
</div>
CSS:
.test {
position: relative;
h2 {
background-color: #bebebe;
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
}
}
This works well for big and medium screens but the problem is on smaller screens. After all elements stack to one column the problem appears with smaller images. On bigger screens where there are multiple elements in one row there is no problem, text appears on the bottom of the image. The problem is that some images are not big enough on smaller screens as they need to have width 100% of the screen and they are only 300-400ox wide. Because of that they don't use 100% of the screen, but header does use it.
It looks something like this:
**********************************
* *
* *
* Image *
* *
* *
********************************************
* Header *
********************************************
So, header spreads all the way to the left and right of the screen and jumps outside of the image. How to keep header inside of the image no matter of screen size?
Thank you!
Try this:
Demo : http://jsfiddle.net/lotusgodkk/bm3mjhm1/
CSS:
.test {
position: relative;
display:inline-block; //Add display:inline-block; if it doesn't affect your code.
}
img {
max-width:100%;
}
h2 {
background-color: #bebebe;
position: absolute;
bottom: 0;
left: 0;
right:0; // Remove width:100% and add left,right offset.
}
HTML:
<div class="test">
<img src="http://lorempixel.com/400/200/sports/1/" />
<h2>Sample TExt. Sample TExt</h2>
</div>
Check the demo for different sizes of image.
DEMO: http://jsbin.com/nobape
There are two options. The first is the answer, but it's not the best idea. When the viewport gets very small, the caption text can cover up a good portion of the image. When you look at the demo, the second row only does the caption over the image at the 500px min-width and under that, it stacks, which looks very nice and easy to read.
CSS
.img-full-width {
width: 100%;
height: auto;
}
.caption {
position: relative;
margin-bottom: 2%;
}
.caption h3 {
margin: 0;
color: #fff;
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 10px;
background: rgba(41,82,123,.8);
font-size: 15px;
}
.caption-2 {
position: relative;
margin-bottom: 2%;
}
.caption-2 h3 {
margin: -1px 0 0 0;
color: #fff;
padding: 10px;
background: rgba(41,82,123,1);
font-size: 15px;
}
#media (min-width:500px) {
.caption-2 h3 {
margin:0;
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: rgba(41,82,123,.8);
}
}
HTML
<div class="container">
<div class="row">
<div class="col-sm-4">
<div class="caption">
<img src="http://placekitten.com/g/400/300" class="img-full-width alt="" />
<h3>My Caption Goes Here</h3>
</div>
</div>
<div class="col-sm-4">
<div class="caption">
<img src="http://placekitten.com/g/400/300" class="img-full-width alt="" />
<h3>My Caption Goes Here</h3>
</div>
</div>
<div class="col-sm-4">
<div class="caption">
<img src="http://placekitten.com/g/400/300" class="img-full-width alt="" />
<h3>My Caption Goes Here</h3>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-4">
<div class="caption-2">
<img src="http://placekitten.com/g/400/300" class="img-full-width alt="" />
<h3>My Caption Goes Here</h3>
</div>
</div>
<div class="col-sm-4">
<div class="caption-2">
<img src="http://placekitten.com/g/400/300" class="img-full-width alt="" />
<h3>My Caption Goes Here</h3>
</div>
</div>
<div class="col-sm-4">
<div class="caption-2">
<img src="http://placekitten.com/g/400/300" class="img-full-width alt="" />
<h3>My Caption Goes Here</h3>
</div>
</div>
</div>

On hover, hide one div, display another

I have seen this question have been asked many times, but mine is a little complicated.
I am using bootstrap on my website, and basically, I am trying to join two images one half is a customer image, other half is a business image. What actually I'd like is, when one hover overs the first half i.e the customer image, the second half i.e the business image should turn to the second half of the customer image and the vice versa when someone hovers over the business image.
Here's my HTML code.
<div class="pics">
<div class="1half">
<div class="col-sm-2" style="padding-right: 0;" id="b1">
<img src="image/b1.png" alt="" width="340px" style="float: right;">
</div>
<div class="col-sm-2" style="padding-right: 0; display: none;" id="c1">
<img src="image/c1.png" alt="" width="340px" style="float: right;">
</div>
</div>
<div class="2half">
<div class="col-sm-2" class="flash" style="padding-left: 0;" id="c2">
<img src="image/c2.png" alt="" width="338px">
</div>
<div class="col-sm-2" class="flash" style="padding-left: 0; display: none;" id="b2">
<img src="image/b2.png" alt="" width="338px">
</div>
</div>
In the above code, what I want is when someone hovers over #b1: #c2 should go away, and #b2 should be visible. I tried implementing CSS changes but it doesn't work.
I have added the link on JSfiddle here. http://jsfiddle.net/2R5bq/
Basically on hover, both should be the same.
No need for so many div's. One main wrapper, two image wrappers/masks is all you need. See this JSFiddle a threw together.
HTML
<div id="imageWrapper">
<div id="imageLeftImageWrapper">
<image src="http://lorempixel.com/320/180/animals/" />
</div>
<div id="imageRightImageWrapper">
<image src="http://lorempixel.com/320/180/cats/" />
</div>
</div>
CSS
#imageWrapper {
position: relative;
width: 320px;
height: 180px;
}
#imageWrapper #imageLeftImageWrapper {
position: absolute;
top: 0px;
left: 5px;
width: 160px;
height: 180px;
overflow: hidden;
}
#imageWrapper #imageRightImageWrapper {
position: absolute;
top: 0px;
right: 0px;
width: 160px;
height: 180px;
overflow: hidden;
}
#imageWrapper #imageRightImageWrapper img {
position: absolute;
right: 0px;
}
#imageWrapper #imageLeftImageWrapper:hover,
#imageWrapper #imageRightImageWrapper:hover {
width: 320px;
z-index: 1;
}

html5 Background Video Full Screen

im trying to make html5 Background Video in my website . but i have some problem with the IE and Google Chrome .. i have made Live example HERE
Can any one please tell me what is wrong with my video i found it black screen in Google Chrome and not working in IE
CSS:
<section class="container-1140" id="mast" style="height: 775px;">
<div style="overflow:hidden; background:url(http://riskeverything.us/wp-content/themes/risky/images/splash-home.jpg) no-repeat; background-size:cover;" id="mast_inner-1">
<div id="mast_inner-2">
<video loop="1" autoplay="1" id="mast_inner-2" class="_534g" style="display: block;" controls="true">
<source src="video/video.mp4"></source>
<source src="video/video.webmhd.webm"></source>
<img src="video/poster.jpg">
</video>
</div>
</div>
</section>
The HTML is :
<section class="container-1140" id="mast" style="height: 775px;">
<div style="overflow:hidden; background:url(http://riskeverything.us/wp-content/themes/risky/images/splash-home.jpg) no-repeat; background-size:cover;" id="mast_inner-1">
<div id="mast_inner-2">
<video loop="1" autoplay="1" id="mast_inner-2" class="_534g" style="display: block;" controls="true">
<source src="video/video.mp4"></source>
<source src="video/video.webmhd.webm"></source>
<img src="video/poster.jpg">
</video>
</div>
</div>
</section>
you can use this plugin. it is simple and it can solve your task .
You could use CSS only, which will work for most browsers
#video_background {
position: fixed;
bottom: 0px;
right: 0px;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 100;
overflow: hidden;
}
z index should be -100 to make it a background video in chrome
You need to embed ID of your video which you want to set in your background . Try this
http://jsfiddle.net/bfvopg6p/

css - why my text box is not showing up?

On my website, section "Presse and Medias", I'd like a white square to appear a few px next to the video (on the right side) with the word "hello" in it.
Unfortunately this is not working. I see the word hello, but not in a white square.
Any idea what the issue is and how to fix it?
Many thanks,
Here is my html:
<div class="section" id="medias">
<div class="center">
<iframe width="350" height="200" class="youtube-player" src="http://www.youtube.com/embed/qqXi8WmQ_WM" frameborder="0" allowfullscreen></iframe>
<div id="medias-txt"
<p>hello</p></div>
</div>
</div><!--END page4-->
And here is my css:
#medias-txt
{
background-color:#fff;
color:#000;
width:100px;
height:100px;
padding:10px;
float:right;
}
You aren't closing your div tag
<div class="section" id="medias">
<div class="center">
<iframe width="350" height="200" class="youtube-player" src="http://www.youtube.com/embed/qqXi8WmQ_WM" frameborder="0" allowfullscreen></iframe>
<div id="medias-txt">
<p>hello</p></div>
</div>
</div><!--END page4-->
This should do the trick.
PS Love the video on that page :)
In your css, you need to add spaces between the colons and the content.
eg:
#medias-txt
{
background-color: #fff;
color: #000;
width: 100px;
height: 100px;
padding: 10px;
float: right;
}

Resources