如何让导航使用全宽视频背景



我有一个具有完整视频背景的网页。 我的导航工作正常,但是当我将"video-container"类从 0 更改为 -6 以便我的视频填满页面顶部时,即使我看到它,它也不允许我选择导航。 我已经尝试了我能想到的所有方法,但仍然没有成功。 有人可以帮忙吗?

这是 HTML:

<!DOCTYPE html>
<html>
<head>
    <!---Bootstrap--->
    
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
      
      <link rel="stylesheet" href="Animation.css">
      
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
        
        <!--Bootstrap meta name-->
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
<!--Metadata from W3 Schools--->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
<!--CSS Style-->
    
</head>
    
    
    <!---Website Content--->
    
<body>
<div id="myNav" class="overlay">
  <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
  <div class="overlay-content">
    <a href="Animation.html">Home</a>
  <a href="History.html">History</a>
  <a href="Techniques.html">Techniques</a>
  <a href="Production.html">Production</a>
  <a href="Visual_FX.html">Visual FX</a>
    <a href="Characters_&_Gaming.html">Characters & Gaming</a>
  </div>
</div>
<span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; </span>
<script>
function openNav() {
  document.getElementById("myNav").style.width = "50%";
}
function closeNav() {
  document.getElementById("myNav").style.width = "0%";
}
</script>
    
    <div class = "header-container">
        <div class = "video-container">
        <video preload = "true" autoplay = "autoplay" loop = "loop">
            <source src = "Animation_Montage2.mp4" type = "video/mp4">
            <source src = "Animation_Montage2.webm" type = "video/webm">
            <source src = "Animation_Montage2.ogv" type = "video/ogg">
             </video>
        </div>
    
    </div>
    
    
    
<!--
    <div class="embed-responsive embed-responsive-21by9">
  <iframe class="embed-responsive-item" src="Animation_Montage2.mp4"></iframe>
</div>
-->
    
<!--
    <div class="embed-responsive embed-responsive-21by9">
  <iframe class="embed-responsive-item" src="Animation_Montage2.mp4"></iframe>
</div>
-->
<!--
    <header class="v-header container">
    <div class="fullscreen-video-wrap">
        <video contorols autoplay muted loop>>
               <source src="Animation_Montage2.mp4" type = "video/mp4">
    </video>
    </div>
    </header>
-->
</body>
</html>

这是 CSS

.v-header{
  height:100vh;
  display:flex;
  align-items:center;
  color:#fff;
}
.container{
  max-width:960px;
  padding-left:1rem;
  padding-right:1rem;
  margin:auto;
  text-align:center;
}
.fullscreen-video-wrap{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100vh;
  overflow:hidden;
}
.fullscreen-video-wrap video{
  min-height:100%;
  min-width:100%;
}
.header-container{
    width: 100%;
    height: 900px;
    border-left: none;
    border-right: none;
    position: relative;
    padding: 20px;
}
.video-container{
    position: absolute;
    top: -6%;
    left: 0%;
    height: 100%;
    width: 100%;
    overflow: hidden;
}
video{
    position: absolute;
    z-index: -1;
    width: 100%;
}
<!--Navigation-->
html,body {
  font-family: 'Lato', sans-serif;
    background-color: black;
}
    
span{
        color: white;
        padding-left: 30px;
        padding-bottom: 30px;
        padding-top: 30px;
        padding-right: 30px;
    }
.overlay {
  height: 100%;
  width: 0;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0, 0.9);
  overflow-x: hidden;
  transition: 0.5s;
}
.overlay-content {
  position: relative;
  top: 25%;
  width: 100%;
  text-align: center;
  margin-top: 30px;
}
.overlay a {
  padding: 8px;
  text-decoration: none;
  font-size: 36px;
  color: #818181;
  display: block;
  transition: 0.3s;
}
.overlay a:hover, .overlay a:focus {
  color: #f1f1f1;
}
.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
}
@media screen and (max-height: 450px) {
  .overlay a {font-size: 20px}
  .overlay .closebtn {
  font-size: 40px;
  top: 15px;
  right: 35px;
  }
}

没关系,我已经找到了解决方案。 我为视频制作了 z 索引 -1 和跨度导航 1。 这样,视频就在导航后面。

相关内容

  • 没有找到相关文章

最新更新