首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

jquery 闪耀

2012-11-23 
jquery 闪烁function?shake(ele,cls,times){? ? ? ? ? ?? ? ? ? var?i??0,t?false?,o?ele.attr(class

jquery 闪烁

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

热点排行