【发布时间】:2010-10-11 04:43:15
【问题描述】:
我有一个使用精灵制作的导航。除了客户想要悬停和悬停效果之外,它几乎是完美的。我使用 :hover 来实现,但他也希望精灵具有淡入淡出效果。
Here is the site I am currently working on.
我试过这个:
$("nav ul a").hover(function(){
$(this).stop().fadeTo(300, 0.9);
}, function(){
$(this).stop().fadeTo(300, 0.1);
}).fadeTo(0, 0.7);
但这会使整个导航变得透明。那不是我真正想要的。我确实在导航下方添加了一个深色背景,但它仍然看起来不正确。我想不出其他方法可以做到这一点。
这是 CSS:
nav ul { position: relative; z-index: 1000; margin: -26px 0 0 11px; overflow: hidden; }
nav ul li { display: inline; }
nav ul li a { background: url(../images/nav-sprite.png); display: block; float: left; text-indent: -999px; margin: 0 auto; width: 667px; } nav ul a#nav-1 { background-position: 0 0; height: 48px; width: 103px; }
nav ul a#nav-2 { background-position: -103px 0; height: 48px; width: 129px; }
nav ul a#nav-3 { background-position: -234px 0; height: 48px; width: 156px; }
nav ul a#nav-4 { background-position: -392px 0; height: 48px; width: 147px; }
nav ul a#nav-5 { background-position: -541px 0; height: 48px; width: 124px; }
nav ul a#nav-1:hover { background-position: 0 48px; }
nav ul a#nav-2:hover { background-position: -103px 48px; }
nav ul a#nav-3:hover { background-position: -234px 48px; }
nav ul a#nav-4:hover { background-position: -392px 48px; }
nav ul a#nav-5:hover { background-position: -541px 48px; }
所以现在的默认导航不能有那种透明的外观。它需要是正常的。但是当我将鼠标悬停在按钮上时,我希望悬停效果淡入淡出.....可以这样做吗?
【问题讨论】:
-
这和你之前的问题很接近了吧?
-
是的,我很抱歉,但我无法得到正确的答案......我需要尽快找到方法......
-
那么,您应该对上一个问题的答案发表评论,并可能澄清问题,而不是创建一个新问题...
标签: jquery css jquery-animate