-
Notifications
You must be signed in to change notification settings - Fork 0
/
Responsive-Youtube-Video-With-Lazy-Loading-OnClick.html
72 lines (72 loc) · 1.7 KB
/
Responsive-Youtube-Video-With-Lazy-Loading-OnClick.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<meta content='width=device-width,minimum-scale=1,initial-scale=1' name='viewport'/>
<meta content='IE=9; IE=8; IE=7; IE=EDGE; chrome=1' http-equiv='X-UA-Compatible'/>
<link href='https://cdn.rawgit.com/KompiAjaib/font-awesome-4.6.3/master/css/font-awesome.min.css' rel='stylesheet'/>
<style>
/*<![CDATA[*/
.youtube_box{
max-width:600px;
width:100%;
margin:0 auto;
clear:both;
}
.youtube{
text-align:center;
margin:0 auto;
width:100%;
}
.youtube-resposive{
position:relative;
padding-bottom:56.25%;
height:0;
overflow:hidden;
margin:0;
}
.youtube img{
width:100%;
height:auto;
margin-top:-9%;
z-index:1;
}
.youtube iframe{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:2;
}
.youtube-resposive:before{
content:"\f16a";
font-family:FontAwesome;
font-size:400%;
position:absolute;
top:50%;
left:50%;
margin:-32px 0 0 -32px;
cursor:pointer;
opacity:.7;
transition: all 0.2s ease-out;
}
.youtube-resposive:hover:before{
color:red!important;
opacity:1;
}
/*]]>*/
</style>
<div class="youtube_box">
<div class="youtube" onclick="videoPlay(this)">
<div class="youtube-resposive">
<img alt="youtube image" src="http://i.ytimg.com/vi/qwN01jlSD8c/sddefault.jpg" width="500" height="281"/>
<!--<iframe src="http://www.youtube.com/embed/qwN01jlSD8c?autoplay=1&autohide=1" frameborder="0" allowfullscreen="1"></iframe>-->
</div>
</div>
<script>
//<![CDATA[
function videoPlay(anchor){
anchor.innerHTML = anchor.innerHTML.replace('<!--','').replace('-->','');
anchor.onclick= null;
return false;
};
//]]>
</script>
</div>