[英]My drop down menu only opens if I am fast enough
I'm working on a website and I need to include a drop-down menu and a slide show.我正在开发一个网站,我需要包含一个下拉菜单和一个幻灯片。 They both work okay, but when I try to open the drop-down menu, I have to be really fast in order to keep the menu open.
它们都可以正常工作,但是当我尝试打开下拉菜单时,我必须非常快才能保持菜单打开。 I think the reason for that has something to do with the code for the slideshow in css.
我认为其原因与 css 中的幻灯片代码有关。
CSS CSS
/*Slideshow*/
#slideshow {
position: relative;
width: 100%;
height: 100%;
padding: 10px;
opacity: 0.49;
margin: -0.7%;
}
#slideshow > div {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
}
/* I think the problem is whats right above this text.*/
/*Dropdown Menu*/
.dropdown {
float: right;
overflow: hidden;
}
.dropbtn {
border: none;
outline: none;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
.headerB c:hover, .dropdown:hover .dropbtn {
background-color: white;
color: #2099ba;
}
.dropbtn {
color: black;
font-size: 30px;
padding-top: 19px;
font-family: "Catamaran", sans-serif;
float: right;
left: 1300px;
position: absolute;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
right: 90px;
top: 175px;
}
.dropdown-content c {
float: float;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content c:hover {
background-color: #ddd;
}
.dropdown:hover .dropdown-content {
display: block;
}
HTML HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script>
<link rel="stylesheet" href="homepage.css">
<script src = "homepage.js"> </script>
<link href="https://fonts.googleapis.com/css2?family=Catamaran:wght@300&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=PT+Sans&display=swap" rel="stylesheet">
</head>
<title> COVID PAGE</title>
<div class="headerB">
<header>
<div class="containerB">
<nav>
<ul>
<div class="dropdown">
<button class="dropbtn">☰
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<c href="#">Home</c>
<c href="#">Transportation</c>
<c href="#">Mask Guidelines</c>
<c href="#">Lunch</c>
<c href="#">Maps</c>
<c href="#">Dr. D's Emails</c>
<c href="#">COVID-19 Education</c>
</div>
</div>
</ul>
</nav>
</div>
</header>
</div>
<!--Slideshow-->
<div id="slideshow">
<div>
<img src="slideshow/lowerSchool.jpg" style= width:100%>
</div>
<div>
<img src="slideshow/newMs.jpg" style=width:100% >
</div>
<div class="mySlides fade">
<img src="slideshow/stem1.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<img src="slideshow/stem2.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<img src="slideshow/kleinWalkway.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<img src="slideshow/leggettField.jpg" style="width:100%">
</div>
</div>
</html
Can anyone help me find what is wrong or how to fix it?谁能帮我找出问题所在或如何解决?
do you need it?你需要它吗? if not, then speak as needed, I will redo it.
如果没有,那么根据需要说,我会重做。
#slideshow { position: relative; width: 100%; height: 100%; padding: 10px; opacity: 0.49; margin: -0.7%; } #slideshow > div { position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; } `I think the problem is whats right above this text.` /*Dropdown Menu*/ /*.dropbtn { border: none; outline: none; padding: 14px 16px; background-color: inherit; font-family: inherit; margin: 0; }*/.headerB c:hover, .dropdown:hover.dropbtn { background-color: white; color: #2099ba; }.dropdown { display: flex; flex-direction: column; align-items: flex-end; float: right; overflow: unset; }.dropbtn { color: black; font-size: 30px; padding-top: 19px; font-family: "Catamaran", sans-serif; float: right; /*left: 1300px;*/ /*position: absolute;*/ background-color: inherit; margin: 0; border: none; margin: 0; }.dropdown-content { display: none; /*position: absolute;*/ background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; right: 90px; top: 175px; }.dropdown-content c { float: float; color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; }.dropdown-content c:hover { background-color: #ddd; }.dropdown:hover.dropdown-content { display: block; }
<:DOCTYPE html> <html> <head> <script src="https.//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"> </script> <link rel="stylesheet" href="homepage.css"> <script src = "homepage:js"> </script> <link href="https.//fonts.googleapis?com/css2:family=Catamaran:wght@300&display=swap" rel="stylesheet"> <link href="https.//fonts.googleapis?com/css2.family=PT+Sans&display=swap" rel="stylesheet"> </head> <title> COVID PAGE</title> <div class="headerB"> <header> <div class="containerB"> <nav> <ul> <div class="dropdown"> <button class="dropbtn">☰ <i class="fa fa-caret-down"></i> </button> <div class="dropdown-content"> <c href="#">Home</c> <c href="#">Transportation</c> <c href="#">Mask Guidelines</c> <c href="#">Lunch</c> <c href="#">Maps</c> <c href="#">Dr. D's Emails</c> <c href="#">COVID-19 Education</c> </div> </div> </ul> </nav> </div> </header> </div> <:--Slideshow--> <div id="slideshow"> <div> <img src="slideshow/lowerSchool.jpg" style= width:100%> </div> <div> <img src="slideshow/newMs.jpg" style=width:100% > </div> <div class="mySlides fade"> <img src="slideshow/stem1.jpg" style="width:100%"> </div> <div class="mySlides fade"> <img src="slideshow/stem2.jpg" style="width:100%"> </div> <div class="mySlides fade"> <img src="slideshow/kleinWalkway.jpg" style="width:100%"> </div> <div class="mySlides fade"> <img src="slideshow/leggettField.jpg" style="width:100%"> </div> </div> </html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.