模态显示正确,但是当我点击模态时。视频和视频控制混乱了。如果我做错了,请建议是否有其他合适的方式。
我有一个很好的并且显示视频的库,但是id没有提供像bootstrap模式那样关闭弹出窗口的任何选项。
<!DOCTYPE html>
<html>
<head>
<title>Popup Video</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
.video-js .vjs-tech {
position: relative;
height: inherit;
}
.player {
width: 80%;
margin-left: auto;
margin-right: auto;
background:black;
}
</style>
</head>
<body>
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p> test </p>
<video id="my-video" class="video-js" controls preload="video-js vjs-default-skin vjs-big-play-centered" width="640" height="264"
poster="https://d9wrv003o8xvb.cloudfront.net/thumb_0801180537104122.jpg" data-setup='{}'>
<source src="https://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
<source src="https://vjs.zencdn.net/v/oceans.mp4" type='video/webm'>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://vjs.zencdn.net/6.6.3/video.js"></script>
<script>
</script>
</body>
</html>
我在这里附上图片,显示控件是如何搞砸的。
答案 0 :(得分:0)
您需要参考VideoJS样式表:https://vjs.zencdn.net/7.2.3/video-js.css
<!DOCTYPE html>
<html>
<head>
<title>Popup Video</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://vjs.zencdn.net/7.2.3/video-js.css">
<style>
.video-js .vjs-tech {
position: relative;
height: inherit;
}
.player {
width: 80%;
margin-left: auto;
margin-right: auto;
background: black;
}
</style>
</head>
<body>
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p> test </p>
<video id="my-video" class="video-js" controls preload="video-js vjs-default-skin vjs-big-play-centered" width="640" height="264" poster="https://d9wrv003o8xvb.cloudfront.net/thumb_0801180537104122.jpg" data-setup='{}'>
<source src="https://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
<source src="https://vjs.zencdn.net/v/oceans.mp4" type='video/webm'>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://vjs.zencdn.net/6.6.3/video.js"></script>
<script>
</script>
</body>
</html>