Jquery褪色背景上悬停? [英] Jquery fade background on hover?

查看:102
本文介绍了Jquery褪色背景上悬停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个没有背景的链接和一个css规则,它改变了鼠标悬停后的背景。



父项bg是白色的,悬停链接 - 蓝色。 / p>

如何缓慢执行悬停效果,从白色到蓝色?



感谢。

  li a {} 
li a:hover {background:blue; }


解决方案

  jQuery ('a#theLink')。hover(function(){
$(this).stop()。animate({backgroundColor:'blue'});
},function $ b $(this).stop()。animate({backgroundColor:'white'});
});

为此,您需要下载 color plugin


There is a link, with no background, and a css rule, which changes background on hover.

Parent bg is white, link on hover - blue.

How can I do a hover effect slowly, from white to blue?

Thanks.

li a {}
li a:hover { background: blue; }

解决方案

jQuery('a#theLink').hover(function(){
    $(this).stop().animate({backgroundColor: 'blue'});
}, function() {
    $(this).stop().animate({backgroundColor: 'white'});
});

For this to work you need to download the "color plugin" for jQuery.

这篇关于Jquery褪色背景上悬停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆