我正在尝试使用css类进行登录表单背景颜色(渐变)更改:
.smallWindow-info{
background-color: #339bb9;
background-image: -khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9));
background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
background-image: -ms-linear-gradient(top, #5bc0de, #339bb9);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9));
background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
background-image: linear-gradient(top, #5bc0de, #339bb9);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);
}
.smallWindow-warning{
background-color: #eedc94;
background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94));
background-image: -moz-linear-gradient(top, #fceec1, #eedc94);
background-image: -ms-linear-gradient(top, #fceec1, #eedc94);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94));
background-image: -webkit-linear-gradient(top, #fceec1, #eedc94);
background-image: -o-linear-gradient(top, #fceec1, #eedc94);
background-image: linear-gradient(top, #fceec1, #eedc94);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0);
}
但是ID不起作用请帮忙 这是代码。 http://jsfiddle.net/4JFpa/
答案 0 :(得分:1)
您可以使用css动画。只需更改css类。
.smallWindow-warning{
background-color: #339bb9;
background-image: linear-gradient( rgba(255,255,255,0.6), rgba(0,0,0,0.6) );
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
animation: smallWindow-warning 5s forwards;
}
@keyframes smallWindow-warning {
100% {background-color: #eedc94;}
}
答案 1 :(得分:0)
试试这个:你需要在引号中传递类名(两者都要删除/添加)。并在动画完成后删除info类,然后添加警告类并开始动画。
$(document).ready(function(){
$( "#loginPanel").animate({
opacity: 0
}, 3000, function() {
$(this).removeClass('smallWindow-info').addClass('smallWindow-warning').animate({ opacity: 1 }, 3000);
});
});
<强> Demo 强>