使用color plugin在悬停时设置背景颜色动画。
$(function() {
$('.listing-2 li a').mouseover(function() {
$(this).animate({
backgroundColor: "#0e7796"
}, 'fast');
});
$('.listing-2 li a').mouseout(function() {
$(this).animate({
backgroundColor: "#d6f2c5"
}, 'fast');
});
});
如何对边框颜色执行相同的操作?
发布于 2009-05-01 22:11:11
在google中找到
$('.listing-2 li a').mouseover(function() {
$(this).animate({ borderTopColor: "#0e7796" }, 'fast');
});
$('.listing-2 li a').mouseout(function() {
$(this).animate({ borderTopColor: "#fff" }, 'fast');
});
必须是"borderTopColor“(或者”left“、”right“、”bottom“)而不是"borderColor”。
发布于 2010-07-20 04:46:54
要为整个边框的颜色设置动画,请执行以下操作:
$(this).animate({ borderTopColor: '#59b4de', borderLeftColor: '#59b4de', borderRightColor: '#59b4de', borderBottomColor: '#59b4de' }, 'fast');
显然,您需要将它们都指定出来。
发布于 2012-02-13 10:55:43
这也是可行的。
$("div.item").hover(function() {
$(this).stop().animate({"border-color": "#999999"}, "slow");
},
function() {
$(this).stop().animate({"border-color": "#BFBFBF"}, "slow");
});
https://stackoverflow.com/questions/813493
复制相似问题