什么css和jquery用来改变背景的颜色

时间:2016-05-20 09:46:46

标签: jquery css

我刚刚看到这个页面,并喜欢不断改变颜色的方式。我检查了源代码,但没有找到用于更改颜色的脚本。 TFS deleted my files when changing the mapping

任何人都可以指出我正确的方向。用于创建具有不断变化的背景颜色的页面的脚本?

2 个答案:

答案 0 :(得分:1)

在该页面上,它是通过css3动画完成的。这是他们的确切代码:

.page--voter-reg {
    animation: 17s ease 0s normal none infinite running fifty50;
    background: rgba(0, 0, 0, 0) linear-gradient(90deg, #ff3e41, #38618c) repeat scroll 0 0 / 400% 400%;
    padding: 120px 0;
}
@keyframes fifty50 {
    0% {
        background-position: 0 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

答案 1 :(得分:0)

这里有点儿方法......

$(document).ready(function() {  
 setInterval(function() {
    $('body').animate( { backgroundColor: 'red' }, 300)
    .animate( { backgroundColor: 'green' }, 300); 
    }, 1000);

 });  

check it here