Javascript 在Div容器中100%播放视频
如何使Youtube视频在DIV容器中100%播放 div的宽度:940px div的高度:400pxJavascript 在Div容器中100%播放视频,javascript,jquery,youtube,video.js,Javascript,Jquery,Youtube,Video.js,如何使Youtube视频在DIV容器中100%播放 div的宽度:940px div的高度:400px <div class="videojs-wrapper"> <div class="video-js-player"> <video id="vid1" src="" class="video-js vjs-default-skin" autoplay="autoplay" muted loop preload="auto" width=
<div class="videojs-wrapper">
<div class="video-js-player">
<video id="vid1" src="" class="video-js vjs-default-skin" autoplay="autoplay" muted loop preload="auto" width="100%" height="400px" data-setup='{ "techOrder": ["youtube"], "src": "http://www.youtube.com/embed/5PaIjFd02js?enablejsapi=1" }'>
</video>
</div>
</div>
.video-content {
width:100%;
height:300px;
background:#f2f2f2;
font-size:18px;
font-family:verdana;
font-weight:bold;
color:#aaa;
border:1px solid #aaa;
margin-top:10px;
}
.videojs-wrapper {
position:relative;
}
.video-js-play {
position: absolute;
top: 0;
background-color: #fff;
padding: 10px;
right: 47%;
left: 44%;
width: 100px;
bottom: 0;
top: 40%;
text-align: center;
height: 36px;
}
.video-js-player {
position:relative;
}
.视频内容{
宽度:100%;
高度:300px;
背景#f2f2;
字号:18px;
字体系列:verdana;
字体大小:粗体;
颜色:#aaa;
边框:1px实心#aaa;
边缘顶部:10px;
}
.videojs包装器{
位置:相对位置;
}
.视频播放{
位置:绝对位置;
排名:0;
背景色:#fff;
填充:10px;
右:47%;
左:44%;
宽度:100px;
底部:0;
最高:40%;
文本对齐:居中;
高度:36px;
}
.js视频播放器{
位置:相对位置;
}
我想你可以做到这一点:
.video-js-player {
position:relative;
width:940px;
height:400px;
}
.video-content {
width:100%;
height:100%;//Change this to also 100%
background:#f2f2f2;
font-size:18px;
font-family:verdana;
font-weight:bold;
color:#aaa;
border:1px solid #aaa;
margin-top:10px;
}