Site link: http://robertdelmaestro.com/
You will see when you go to the website that we needed an overlay on top of the embedded video from Vimeo so we could show the title of the video. The Vimeo title didn't fit with the sites intended style.
So the idea is that users can see the title of the video but as soon as the mouse hovers over it the overlay should disappear so the video can be played and viewed. I got the overlay layer to be click through by using pointer-events: none; so the overlay didn't obscure the controls below.
I've used the attached code to achieve this but it has shortcomings. On hover the overlay is removed but it comes back when mouse leaves obscuring the video. I would like to fix this so that the titled overlay doesn't return.
After looking at various examples on this site I added the animation-fill-mode: forwards; to achieve this but it didn’t work.
Just to reiterate: The overlays need to disappear on hover completely. They should only return when the video has finished and a different video has been selected.
Some links I used to find answers that either didn't work or didn't do what I intended them to.
Not quite: Animate CSS Overlay to FadeIn and FadeOut
Nearly: http://blog.teamtreehouse.com/using-jquery-to-detect-when-css3-animations-and-transitions-end
I was hopeful, denied: Adding a overlay layer on an embedded vimeo player
.box {overflow: hidden; position: relative;}
.box iframe {position: absolute; left: 0;}
.box .overbox {
background-color: #fff;
border: 1px solid #000;
position: absolute;
top: 0;
left: 0;
color: #fff;
z-index: 100;
opacity: 1;
width: 100%;
height: 100%;
padding: 40px 20px;
}
.box:hover .overbox {
animation-name: fadeboxinandout;
animation-duration: 2s;
pointer-events: none;
animation-iteration-count: 1;
animation-fill-mode: forwards;}
@keyframes fadeboxinandout {
0% {opacity: 1;}
100% {opacity: 0;}
}
.box .title {
text-align: center; font-size: 1em; color: #387e9f;
}
<div class="box"><iframe src="https://player.vimeo.com/video/161447671" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" frameborder="0" height="281" width="500"></iframe><div class="overbox">
<div class="title overtext">Mr Selfridge<br>Ep1 S4</div>
</div>
</div>