简体   繁体   English

带有 React Burger 菜单的 z-index 不起作用

[英]z-index with React Burger menu not working

I am attempting to use a react-burger-menu.我正在尝试使用 react-burger-menu。 However, my search button is still visible when the menu pops up.但是,当菜单弹出时,我的搜索按钮仍然可见。 I have tried a z-index value of 1, 100, and 10000我尝试了 1、100 和 10000 的 z-index 值

仪表板主页

搜索按钮仍然可见

Here is the CSS class for my dropdown content (which styles the burger menu)这是我的下拉内容的 CSS class (其中 styles 汉堡菜单)

.dropdown-content {                                                                                                                                                                                                                                                             
  display: none;                                                                                                                                                                                                                                                                
  position: absolute;                                                                                                                                                                                                                                                           
  background-color: #FCFDFD;                                                                                                                                                                                                                                                    
  min-width: 160px;                                                                                                                                                                                                                                                             
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.25);                                                                                                                                                                                                                                 
  z-index: 1;                                                                                                                                                                                                                                                                   
  width: 250px;                                                                                                                                                                                                                                                                 
  right: 0;                                                                                                                                                                                                                                                                     
  top: 5;                                                                                                                                                                                                                                                                       
  border-radius: 2px;                                                                                                                                                                                                                                                           
}                                                                                                                                                                                                                                                                               

Try setting your z-index to a much higher number than 1尝试将您的 z-index 设置为比 1 高得多的数字

here's you could learn how to use z-index在这里你可以学习如何使用 z-index

https://developer.mozilla.org/en-US/docs/Web/CSS/z-index https://developer.mozilla.org/en-US/docs/Web/CSS/z-index

my recommendation is to put the hamburger menu to the end of the body element.我的建议是将汉堡菜单放在 body 元素的末尾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM