【发布时间】:2014-01-17 14:25:51
【问题描述】:
当我使用此功能单击 div 时,我想更改它的边框颜色,但是当我单击 3 个 div 之一时,边框颜色要亮得多。
每个边框都会褪色,但只有活动的不会。为什么?
这是我的小提琴:Fiddle Demo
$('.re').click(function() {
$('.re').removeClass('active').removeAttr('style');
$(this).addClass('active');
});
$(".test1").click(function() {
$(".mainNavitem").stop().animate({"border-right-color":"rgba(255,255,255, 0.2)"}, 800);
$(".active").stop().animate({"backgroundColor":"transparent"}, 800);
$(".bg").stop().animate({"backgroundColor":"rgb(199, 55, 59)"}, 800);
});
$(".test2").click(function() {
$(".mainNavitem").stop().animate({"border-right-color":"rgba(255,255,255, 0.5)"}, 800);
$(".active").stop().animate({"backgroundColor":"transparent"}, 800);
$(".bg").stop().animate({"backgroundColor":"rgb(199, 55, 59)"}, 800);
});
$(".test3").click(function() {
$(".mainNavitem").stop().animate({"border-right-color":"rgba(255,255,255, 1)"}, 800);
$(".active").stop().animate({"backgroundColor":"transparent"}, 800);
$(".bg").stop().animate({"backgroundColor":"rgb(199, 55, 59)"}, 800);
});
【问题讨论】:
标签: javascript jquery