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);

 

posted @ 2015-10-17 17:16  幕三少  阅读(2561)  评论(0编辑  收藏  举报