mouseeneter(
你好朋友,我使用) 和mouseout()
jQuery设计了一个下拉菜单。问题是当我mouseout()
从主菜单中时,下拉链接向上滑动。我不知道如何设置条件请帮忙。我的代码是
jQuery
<script>
$(document).ready(function(){
//alert('hi');
$('#link-detail').css('display','none');
$('#hover-detail').mouseenter(function(){
$('#link-detail').css({position:'absolute',top:'20px',left:'0px',zindex:'99999'});
$('#link-detail').slideDown();
});
$('#hover-detail').mouseout(function(){
$('#link-detail').slideUp();
});
})
</script>
html
<div class="link-detail-wrap"><div id="hover-detail">hover me</div>
<div>
<ul id="link-detail">
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
</ul>
</div></div>
<div>hihihih</div>
CSS
.link-detail-wrap
{
float:left;
width:100%;
position:relative;
}
ul#link-detail
{
margin:0;
padding:0;
border:solid 1px #666;
border-bottom:none;
}
ul#link-detail li
{
list-style:none;
margin:0;
padding:0;
display:inline;
}
ul#link-detail li a
{
text-decoration:none;
color:#333;
padding:2px 50px 2px 10px;
background:#F0F0F0;
border-bottom:1px solid #666;
/*line-height:25px;*/
font:12px "Trebuchet MS", Arial, Helvetica, sans-serif;
text-transform:capitalize;
display:block;
}
ul#link-detail li a:hover
{
background:#CCC;
}
您也可以在http://jsfiddle.net/36CXK/上看到它
请帮忙
提前致谢