六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 41|回复: 0

类似QQ窗口的抖动效果

[复制链接]

升级  1%

55

主题

55

主题

55

主题

举人

Rank: 3Rank: 3

积分
203
 楼主| 发表于 2013-2-7 17:22:46 | 显示全部楼层 |阅读模式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">  <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />     <style type="text/css">#body{text-align:center;}#test{width:119px;position:absolute;margin:10px auto;height:114px;background:url(http://www.blueidea.com/articleimg/2008/05/5766/01.jpg) ;border:2px dotted red;}     </style>     <script type="text/javascript"></script>  </head>  <body>        <div style='margin:10px 200px'><div><input type="button" value="~~~让我抖抖吧~~"  /></div><div><input type="button" value="别抖了眼睛晕的很"  /></div><div id="test"></div>        </div>  </body></html><script type="text/javascript"> var m=document.getElementById("test");function SKclass (obj,Rate,speed) { var oL=obj.offsetLeft; var oT=obj.offsetTop; this.stop=null; this.oTime=null; this.state=0; var om=this; this.start=function(){if(this.state==0){ ostart(); this.state=1;}else{alert("这样你受得了吗?")}  } var ostart=function(){ if(parseInt(obj.style.left)==oL-2){obj.style.top=oT+2+"px";setTimeout(function(){obj.style.left=oL+2+"px"},Rate) } else{obj.style.top=oT-2+"px";setTimeout(function(){obj.style.left=oL-2+"px"},Rate)}om.oTime=setTimeout(function(){ostart()},speed); } this.stop=function(){   clearTimeout(om.oTime);   this.state=0;  }}var nn=new SKclass(m,20,50);</script>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表