※デベロッパーツール等でソースコードをご確認ください(Please check using Developer tools)
.wrap {
width: 640px;
margin: 50px auto 0;
}
.movie-box {
position: relative;
overflow: hidden;
background: url("thumb.jpg") no-repeat;
background-size: cover;
}
.movie-play {
position: absolute;
width: 90px;
height: 90px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: url("thumb_play.png") center center/cover;
}
.movie-play:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
background: #000;
transition: all 0.5s ease-out;
}
.show.movie-play:after {
width: 1.8vh;
height: 1.8vh;
transform: translate(-50%, -50%) scale(100);
transition: transform 0.5s ease-out;
}
.movie-inner {
position: relative;
width: 100%;
padding-top: 66.25%;
z-index: 2;
}
.movie-inner .movie-thumb {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.movie-inner iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
@media screen and (max-width:640px){
.wrap {
width: 100%;
}
}
$(function(){
$('.movie-thumb').on('click',function(){
var movie_thumb = $(this).attr("id");
$('.movie-play').addClass('show');
$(this).fadeOut(1000);
$(this).parent().append('<iframe width="600" height="338" src="https://www.youtube.com/embed/' + movie_thumb + '?rel=0&loop=1&playlist=' + movie_thumb + '" frameborder="0" allowfullscreen></iframe>')
});
});