Enable scroll on Youtube / Vimeo hover
This code allows you to fix the issue with scroll on iframe hover for such video players as YouTube or Vimeo in several lines of CSS code
HTML
<div class="container">
<div class="iframe-wrapper">
<iframe src="https://player.vimeo.com/video/113009024?color=b8b8b8&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div class="iframe-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/8TJiOm5KHys" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
</div>
CSS
/* Mask container to increase document height to let you see the effect */
.container {
height: 1200px;
}
/* Iframe wrapper that allows to make youtube iframe responsive */
.iframe-wrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 15px;
height: 0;
max-width: 400px;
}
/* Responsive iframe styles */
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* Adding pseudo element to iframe parent */
.iframe-wrapper:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
display: block;
}
/* Adding hover effect to pseudo element */
.iframe-wrapper:hover:after {
content: none;
}