Как заставить навигацию работать с полноэкранным видео фоном - PullRequest
0 голосов
/ 08 апреля 2019

У меня есть веб-страница с полным фоном видео.Моя навигация работает, но когда я изменяю класс "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;
  }
}

1 Ответ

0 голосов
/ 10 апреля 2019

Неважно, я должен найти решение. Я сделал z-index для видео -1 и навигации по диапазону 1. Таким образом, видео находится за навигацией.

...