.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
.player { margin-bottom: 20px; position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden; } .player .youtube { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } |
.html
1 2 3 4 |
<label>Youtube</label> <div class="player"> <div id="player[0]" class="youtube"></div> </div> |
.js
1 2 3 4 5 |
<script> var player = new Array(); var id = YouTubeGetID($('#fd_strYoutubeUrl').val()); // Youtube key player[0].loadVideoById(id); </script> |