jQuery下拉菜单不起作用

时间:2017-10-21 16:35:39

标签: jquery html css html5 css3

我正在开发一个Web应用程序并放入jQuery菜单,我在这个网站https://tympanus.net/codrops/2012/10/04/custom-drop-down-list-styling/上取了菜单的基础o示例5,只是下拉菜单不起作用下拉项目不是通过单击Enter / Sign up触发,菜单项已经出现,而不是在单击Enter / Register

时出现

错误菜单

enter image description here

<div id="dd" class="wrapper-dropdown-5" tabindex="1">
  <i class="fa fa-user"></i> Entre/Cadastre-se<span class="caret"></span>
  <ul class="dropdown">
    <li class="conteudo_drop">
      <a href="#"><i class="fa fa-laptop"></i> Meus Pedidos</a>
    </li>
    <li class="conteudo_drop">
      <a href="#"><i class="fa fa-gear"></i> Meus Dados</a>
    </li>
    <li class="conteudo_drop">
      <a href="#"><i class="fa fa-group"></i> Fale Conosco</a>
    </li>
    <li>
      <a href="#"><button type="button" onclick="" class="btn_entrar" >Entrar</button> </a>
    </li>
    <li class="conteudo_drop">
      <a href="cadastro.jsp"> Cliente novo? Cadastre-se</a>
    </li>
  </ul>
</div>

CSS

.wrapper-dropdown-5.active {
  border-radius: 5px 5px 0 0;
  background: #4cbeff;
  box-shadow: none;
  border-bottom: none;
  color: white;
}

.wrapper-dropdown-5.active:after {
  border-color: #82d1ff transparent;
}

.wrapper-dropdown-5.active .dropdown {
  border-bottom: 1px solid rgba(0,0,0,0.2);
  max-height: 400px;
}

.wrapper-dropdown-5 .dropdown li {
  padding: 0 10px ;
}

.wrapper-dropdown-5 .dropdown li a {
  display: block;
  text-decoration: none;
  color: #333;
  padding: 10px 0;
  transition: all 0.3s ease-out;
  border-bottom: 1px solid #e6e8ea;
}

.wrapper-dropdown-5 .dropdown li:last-of-type a {
  border: none;
}

.wrapper-dropdown-5 .dropdown li i {
  margin-right: 5px;
  color: inherit;
  vertical-align: middle;
}

 /* Hover state */

.wrapper-dropdown-5 .dropdown li:hover a {
  color: #57a9d9;
}


    /* Active state */

.wrapper-dropdown-5.active {
  border-radius: 5px 5px 0 0;
  background: #4cbeff;
  box-shadow: none;
  border-bottom: none;
  color: white;
}

.wrapper-dropdown-5.active:after {
  border-color: #82d1ff transparent;
}

.wrapper-dropdown-5.active .dropdown {
  border-bottom: 1px solid rgba(0,0,0,0.2);
  max-height: 400px;
}

.conteudo_drop{
  color:#00008B !important;
}

.conteudo_drop a:hover{
  color: #A9A9A9 !important;
  text-decoration: none;
  font-size: 13pt;
  background-color: white !important;
}

1 个答案:

答案 0 :(得分:0)

试试这个:

#dd{
    display:none;
}

button.js:

function myFunction() {
   document.getElementById("dd").classList.toggle("show");
}

因为我无法完全理解这个问题,所以我提供了部分解决方案。请参阅:page