英文:
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?
<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;
}
答案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;
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论