导航栏的标志在一个页面上不响应,因为背景中有动画播放。

huangapple go评论54阅读模式
英文:

Navbar logo is unresponsive on one page where there is an animation playing in the background

问题

我在导航栏中有一个可点击的标志。它在除了我的JavaScript测验的最后一页之外的每个页面上都起作用,在最后一页有一个背景动画正在播放。我已经调整了动画和标志的z索引,但没有变化。我不知道还可能是什么。我确信这是一些我没有注意到的明显的东西?

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SPLANETS</title>
    <meta content="" name="description">
    <meta content="" name="keywords">
    <!-- Favicons -->
    <link href="assets/img/splanets.ico" rel="icon">
    <!-- Main Bootstrap Css-->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <!-- Main CSS File -->
    <link href="assets/css/style.css" rel="stylesheet">
    <!--Icons-->
    <script src="https://kit.fontawesome.com/128d236a07.js" crossorigin="anonymous"></script>
</head>
<body id="">
  <!-- === Header === -->
  <header>
    <nav class="navbar">
      <div class="container-fluid">
        <a class="navbar-brand mx-auto" href="index.html"><img src="assets/img/splanetslogo1.png" alt="Splanets Logo" class="img-fluid logo rocket-logo"></a>
      </div>
    </nav>
  </header>
  <!--End of Header-->
    <div class="rocket-overlay"></div>
    <video class="fullscreen-video" id="myVideo" autoplay="autoplay" muted >
        <source src="assets/img/rocketlaunch.mp4">
        Your browser does not support the video tag.
    </video>
    <section>
        <div class="card retrycard" style="width: 18rem;">
          <div class="card-body">
            <h5 class="card-title">Woohooo! Blast Off!!</h5>
            <h6 class="card-subtitle mb-2 text-muted"></h6>
            <p class="card-text">10/10! <br> Enter your name below to claim your spot on our leaderboard;
            </p>
            <a href="index.html" class="btn rewatch-btn" role="button"><i class="fa-solid fa-play"></i> Watch the video again</a>
            <br>
            <a href="game.html" class="btn replay-btn" role="button"><i class="fa-solid fa-rocket"></i> Restart Quiz</a>
          </div>
        </div>
      </section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
<script src="/assets/js/script.js"></script>
</body>
</html>
Winner Rocket Luanch
--------------------------------*/
.fullscreen-video {
    position: fixed;
    overflow: hidden;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    z-index: -3;
}

.rocket-overlay {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
}

.logo .rocket-logo {
    transform: translate(-40px);
    max-height: 130px;
    z-index: -4;
}
英文:

I have a clickable logo within the navigation bar. It functions on every page apart from the final page of my javascript quiz where there is an animation playing in the background. I have changed the z index around of both the animation and the logo but no change. I have drawn a blank on what else it could be. Im sure it is something obvious that i am not seeing?

&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
    &lt;title&gt;SPLANETS&lt;/title&gt;
    &lt;meta content=&quot;&quot; name=&quot;description&quot;&gt;
    &lt;meta content=&quot;&quot; name=&quot;keywords&quot;&gt;
    &lt;!-- Favicons --&gt;
    &lt;link href=&quot;assets/img/splanets.ico&quot; rel=&quot;icon&quot;&gt;
    &lt;!-- Main Bootstrap Css--&gt;
    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; integrity=&quot;sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD&quot; crossorigin=&quot;anonymous&quot;&gt;
    &lt;!-- Main CSS File --&gt;
    &lt;link href=&quot;assets/css/style.css&quot; rel=&quot;stylesheet&quot;&gt;
    &lt;!--Icons--&gt;
    &lt;script src=&quot;https://kit.fontawesome.com/128d236a07.js&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body id=&quot;&quot;&gt;
  &lt;!-- === Header === --&gt;
  &lt;header&gt;
    &lt;nav class=&quot;navbar&quot;&gt;
      &lt;div class=&quot;container-fluid&quot;&gt;
        &lt;a class=&quot;navbar-brand mx-auto&quot; href=&quot;index.html&quot;&gt;&lt;img src=&quot;assets/img/splanetslogo1.png&quot; alt=&quot;Splanets Logo&quot; class=&quot;img-fluid logo rocket-logo&quot;&gt;&lt;/a&gt;
      &lt;/div&gt;
    &lt;/nav&gt;
  &lt;/header&gt;
  &lt;!--End of Header--&gt;
    &lt;div class=&quot;rocket-overlay&quot;&gt;&lt;/div&gt;
    &lt;video class=&quot;fullscreen-video&quot; id=&quot;myVideo&quot; autoplay=&quot;autoplay&quot; muted &gt;
        &lt;source src=&quot;assets/img/rocketlaunch.mp4&quot;&gt;
        Your browser does not support the video tag.
    &lt;/video&gt;
    &lt;section&gt;
        &lt;div class=&quot;card retrycard&quot; style=&quot;width: 18rem;&quot;&gt;
          &lt;div class=&quot;card-body&quot;&gt;
            &lt;h5 class=&quot;card-title&quot;&gt;Woohooo! Blast Off!!&lt;/h5&gt;
            &lt;h6 class=&quot;card-subtitle mb-2 text-muted&quot;&gt;&lt;/h6&gt;
            &lt;p class=&quot;card-text&quot;&gt;10/10! &lt;br&gt; Enter your name below to claim your spot on our leaderboard;
            &lt;/p&gt;
            &lt;a href=&quot;index.html&quot; class=&quot;btn rewatch-btn&quot; role=&quot;button&quot;&gt;&lt;i class=&quot;fa-solid fa-play&quot;&gt;&lt;/i&gt; Watch the video again&lt;/a&gt;
            &lt;br&gt;
            &lt;a href=&quot;game.html&quot; class=&quot;btn replay-btn&quot; role=&quot;button&quot;&gt;&lt;i class=&quot;fa-solid fa-rocket&quot;&gt;&lt;/i&gt; Restart Quiz&lt;/a&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/section&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js&quot; integrity=&quot;sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;/assets/js/script.js&quot;&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
Winner Rocket Luanch
--------------------------------*/
.fullscreen-video {
    position: fixed;
    overflow: hidden;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    z-index: -3;
}

.rocket-overlay {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
}

.logo .rocket-logo {
    transform: translate(-40px);
    max-height: 130px;
    z-index: -4;
}

答案1

得分: 0

你应该为标志设置一个更高的 z-index 值,然后是视频和叠加层。像这样:

.fullscreen-video {
    z-index: -1;
}

.rocket-overlay {
    z-index: -2;
}

.logo .rocket-logo {
    z-index: 1;
}
英文:

You should set a higher z-index for the logo then the video and overlay. Like this :

.fullscreen-video {
    z-index: -1;
}

.rocket-overlay {
    z-index: -2;
}

.logo .rocket-logo {
    z-index: 1;
}

huangapple
  • 本文由 发表于 2023年2月8日 23:55:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75388396.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定