当前位置: 代码迷 >> Web前端 >> jquery 闪耀
  详细解决方案

jquery 闪耀

热度:313   发布时间:2012-11-23 00:03:43.0
jquery 闪烁

Jquery闪烁提示特效

样式:.red{ border:1px solid #d00; background:#ffe9e8; color:#d00;}

?

复制代码
function?shake(ele,cls,times){? ? ? ? ? ?

? ? ? ? var?i?=?0,t=?false?,o?=ele.attr("class")+"?",c?="",times=times||2;
????????if(t)?return;
? ? ? ? t=?setInterval(function(){
? ? ? ? ? ? i++;
? ? ? ? ? ? c?=?i%2???o+cls?:?o;
? ? ? ? ? ? ele.attr("class",c);
????????????if(i==2*times){
? ? ? ? ? ?? clearInterval(t);
? ? ? ? ? ?? ele.removeClass(cls);
? ? ? ? ? ? }
? ? ? ? },200);
? ? ?};?

复制代码

?

?

调用:shake($("#ID"),"red",3);

  相关解决方案