我想在我正在處理的網頁上實現此分屏視頻效果。 Here is a picture of the result I have so far如何製作全高分屏視頻?
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>NextDoor Pub&Grill</title>
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<header>
<div class="header__menu full-width">
</div>
</header>
<nav>
<div class="nav flex full-width">
<div class="nav__video flex full-width">
<div id="left">
<div class="nav__video--left" onclick="expandRight()">
<video playsinline autoplay muted loop>
<!--- Inlcude the video files with .webm file first --->
<source src="assets/videoLeft/loop.webm">
<source src="assets/videoLeft/loop.mp4">
<source src="assets/videoLeft/loop.mov">
</video>
</div>
</div>
<div id="right">
<div class="nav__video--right" onclick="expandLeft()">
<video playsinline autoplay muted loop>
<!--- Inlcude the video files with .webm file first --->
<source src="assets/videoRight/loop.webm">
<source src="assets/videoRight/loop.mp4">
<source src="assets/videoRight/loop.mov">
</video>
</div>
</div>
</div>
</div>
</nav>
<script src="js/scripts.js"></script>
</body>
</html>
CSS:
.skin{
}
.full-width{
width: 100%;
}
.flex{
display: -webkit-flex;
display: flex;
}
.nav{
position: absolute;
-webkit-flex-direction: column;
flex-direction: column;
height: 100%;
}
.header__menu{
height: 100px;
background-color: rgba(0,0,255,0.5);
}
.nav__video{
-webkit-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
height: 100%;
}
#left{
width: 50%;
height: inherit;
object-fit: cover;
}
#right{
width: 50%;
height: inherit;
object-fit: cover;
}
.nav__video--left{
}
.nav__video--right{
}
video{
height: 100%;
width: 100%;
object-fit: contain;
}
}
所以,這表現在上面的代碼,該視頻是有大小的div佔據下方的頂部菜單的全高酒吧。但是,視頻只顯示在各自div的上半部分。如何確保視頻佔用全部空白區域,同時保持相同的高寬比? (每個視頻的一部分將被切斷)
IE確實支持它,至少最新的版本和以前的任何東西都被使用了1%。你將會遇到困難,犧牲一段時間讓100%的瀏覽器覆蓋率達到最佳狀態。我相信有一種方法可以解決FF問題。如果我有時間,我會爲你尋找。 – A1raa
感謝這裏的幫助,謝謝! –