样式:.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);

 

相关文章:

  • 2022-12-23
  • 2021-06-11
  • 2022-12-23
  • 2021-06-13
  • 2021-08-14
  • 2022-12-23
  • 2021-11-15
  • 2021-07-13
猜你喜欢
  • 2021-05-13
  • 2021-09-06
  • 2021-09-30
  • 2022-02-07
  • 2022-12-23
  • 2021-06-13
相关资源
相似解决方案