CSS:
[class*="fI_"]{
animation-duration: 1.5s;
animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
-o-animation-iteration-count: infinite;
}
.fI_bg *:not(.btn),.fI_bo *:not(.btn){color:#fff}
.fI_bg{
animation-name:fI_bg;
}
.fI_bo{
animation-name:fI_bo;
}
@keyframes fI_bg{
0%{background-color:#0D78BD;}25%{background-color:#1C3B50;}50%{background-color:#0D78BD;}75%{background-color:#1C3B50;}100%{background-color:#0D78BD;}
}
@keyframes fI_bo{
0%{border-color:#0D78BD;}25%{border-color:#1C3B50;}50%{border-color:#0D78BD;}75%{border-color:#1C3B50;}100%{border-color:#0D78BD;}
}
jQuery 替代方案:
$.fn.fI=function(e){//Flash Item
if(!e){e={}}
if(this){e.e=this}
switch(e.f){
case 0:
break;
default:
switch(e.css){
case 0:
e.d='background-color'
break;
case undefined:
e.d='border-color'
break;
default:
e.d=e.css
break;
}
if(!e.c1){e.c1='#1D89CF'}
if(!e.c2){e.c2='#1aae88'}
if(!e.p){e.p=200}
e.e.css(e.d,e.c1)
setTimeout(function(){
e.e.css(e.d,e.c2)
setTimeout(function(){
e.e.css(e.d,e.c1)
setTimeout(function(){
e.e.css(e.d,e.c2)
setTimeout(function(){
e.e.css(e.d,'')
},e.p)
},e.p)
},e.p)
},e.p)
break;
}
return this
}
这样使用:
如果你不定义 css 会做边框
$('#elementid').fI()
如果你做 0 它会做背景颜色,其他任何东西都将成为属性。所以你可以像这样做字体颜色或框阴影:
$('#elementid').fI({css:'color'})
$('#elementid').fI({css:'box-shadow',c1:'0 0 10px #333',c2:'0 0 5px #F00'})
做背景
$('#elementid').fI({css:0})
使用不同的颜色并以毫秒为单位设置间隔
$('#elementid').fI({c1:'#fff',c2:'#F00',p:1000})