我们有一个链接:
<a href="#">
Some text
<span style="width: 50px; height: 50px; background: url(image.png); overflow: hidden; opacity: 0;"></span>
</a>
我们想要改变的不透明度<span>
当链接悬停时带有一些动画。
我们该怎么做呢?
另一种可能的解决方案:
$("a span").hover(function(){
$(this).stop().animate({"opacity": 1});
},function(){
$(this).stop().animate({"opacity": 0});
});
如果使用fadeOut(),span会塌陷,这样就不会了
EDIT
这要好得多:
$('a:has(span)').hover(function() {
$('span', this).stop().animate({"opacity": 1});
},function() {
$('span', this).stop().animate({"opacity": 0});
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)