这是我的第一个问题!当然,你会在这方面帮助我。
我正在处理这个水平菜单:
HTML:
<div id="menu">
<ul>
<li><a href="#">MENU 1</a>
<ul>
<li><a href="#">SUBMENU 1.1</a>
<ul>
<li><a href="#">SUBMENU 1.1.1</a></li>
</ul></li>
<li><a href="#">SUBMENU 1.2</a></li>
<li><a href="#">SUBMENU 1.3</a></li>
</ul></li>
<li><a href="#">MENU 2</a>
<ul>
<li><a href="#">SUBMENU 2.1</a>
<ul>
<li><a href="#">SUBMENU 2.1.1</a></li>
</ul></li>
</ul></li>
<li><a href="#">MENU 3</a></li>
</ul>
</div>
CSS:
body
{
font-family: "calibri";
margin:0;
padding: 0;
}
#menu
{
width: 100%;
min-width: 400px;
height: 30px;
background-color: #222;
}
#menu ul
{
line-height: 30px;
}
#menu ul li
{
list-style: none;
float: left;
position: relative;
}
#menu ul li a
{
padding-left: 5px;
text-decoration: none;
width: 100px;
height: 30px;
color: white;
background-color: black;
display: block;
}
#menu ul a:hover
{
background-color: grey;
}
#menu li ul
{
display: none;
position: absolute;
left: 0px;
top: 100%;
padding-top: 3px;
padding-left: 3px;
line-height: 20px;
}
#menu li ul li a
{
height: 20px;
font-size: small;
}
#menu li:hover > ul
{
display: block;
}
#menu li ul li a
{
width: 150px;
}
#menu li ul li
{
padding-top: 1px;
}
#menu li ul li ul
{
left: 100%;
top: 0;
}
#menu li:hover > a
{
background-color: grey;
}
查询:
$(function() {
$('li > ul').animate({'opacity': 0});
$('li').hover(function () {
$(this).find('ul:first').stop().animate({'opacity': 1});
},function() {
$(this).find('ul:first').stop().animate({'opacity': 0});
});
});
As you can see, the fade in effect (with opacity) is working when the option is hovered, but how can I make it fade out? 我正在使用 IE9。
谢谢!