下面的Jquery脚本有两种背景颜色,分别设置为在翻转和展开时启动。有没有办法让翻转颜色在推出时消失,而不是淡化另一种颜色?
提前感谢您的帮助。
Jquery的
jQuery(document).ready(function($){
//Set the anchor link opacity to 0 and begin hover function
$("#menu-sample-menu li").hover(function () {
$(this).stop().animate({backgroundColor:'#3333CC'}, 300);
//On mouse-off
}, function () {
$(this).stop().animate({backgroundColor:'#000000'}, 200);
});
});
HTML
<nav id="access">
<ul id="menu-sample-menu" class="menu">
<li id="menu-item-198" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-198"><a href="http://www.threecell.com/demo/category/health-care-professional/">Health Care Professional</a>
</li>
<li id="menu-item-197" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-197"><a href="http://www.threecell.com/demo/category/web-designer/">Web Designer</a>
<ul class="sub-menu">
<li id="menu-item-199" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-199"><a href="http://www.threecell.com/demo/category/construction-worker/">Construction Worker</a>
</li>
</ul>
</li>
</ul>
</nav>
风格
#access {
padding:0 20px;
background:#111;
box-shadow:0 0 7px rgba(0, 0, 0, .1);
}
#access ul {
float:left;
padding:0;
margin:0;
list-style:none;
font-weight:600;
text-transform:uppercase;
}
#access li {
position:relative;
float:left;
padding:0;
margin:0;
}
#access ul li:first-child {
padding-left:0;
}
#access a {
display:block;
padding:15px 24px;
color:#f0f0f0;
text-decoration:none;
}
#menu-sample-menu li {
color: black;
text-shadow: 0px 1px 4px #777;
background-color: green;
padding: 0 12px 0 12px;
}
#menu-sample-menu li a.hover {
background: orange;
}
#access li.current_page_item > a,
#access li.current-menu-item > a {
background: orange;
color: white;
text-decoration:none;
}
#access a span {
color:#999;
font-size:11px;
font-style:italic;
font-weight:normal;
line-height:1.62em;
text-transform:none;
}