繁体   English   中英

当我使用鼠标div时,jquery的div show隐藏了

[英]When I came over with the mouse div, div show hidden for jquery

  if ($("#example").mouseover) { $("#test").show(1500); } 
 #example{ width:350px; height:350px; background-color:black; } #test{ width:350px; height:350px; background-color:black; display:none; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <a id='example'>MENU</a> <div id="test"> <ul> <li>Item1</li> <li>Item1</li> </ul> </div> 

当单击链接时,我想显示一个div作为下拉菜单。 我在哪里做错了?

尝试这个:

#example{
    width:350px;
    height:350px;
    background-color:black;
}

#test{
    width:350px;
    height:350px;
    background-color:black;
    display:none;
}


<a id='example'>MENU</a>
<div id="test">
    <ul>
        <li>Item1</li>
        <li>Item1</li>
    </ul>
</div>

$("#example").mouseover(function() {
      $("#test").show('slow');
}).mouseout(function() {
      $("#test").hide('slow');
});
$(".example").on('mouseover',function(){
  $(".test").show(1500);
});

并改变

<div hidden="hidden" class="test">

<div class="test">

并使用display:none;

.test{

    width:350px;
    height:350px;
    background-color:black;
    display:none;


}

暂无
暂无

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

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