跟随鼠标并呈圆形旋转散开的小花特效代码,一个比较老的特效代码了,烈火小编在网上收集来的,可能有的童鞋早就见过,适合在个人主页上使用,打开网页时,会看到鼠标周围有不断旋转的小花,然后迅速消散的无影无踪。 想知道是什么效果吗,赶紧点击下边的运行按钮吧。 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>鼠标旋转特效</title> </head> <body> <script language="JavaScript"> <!-- var images='/uploads/allimg/1101/liehuo_hua.gif'; var amount=7; var cnter=70; var step; var currStep = 0; var Xpos = 0; var Ypos = 0; if (document.all) { document.write('<div id="ieDiv" style="position:absolute;top:0px;left:0px">') document.write('<div id="c" style="position:relative">'); for (n=0; n < amount; n++) document.write('<img src=" '+images+'" style="position:absolute;top:0px;left:0px">') document.write('</div>') document.write('</div>') function MsieMouseFollow(){ Xpos = document.body.scrollLeft+event.x-5; Ypos = document.body.scrollTop+event.y-5; } document.onmousemove = MsieMouseFollow; } else if (document.layers) { window.captureEvents(Event.MOUSEMOVE); for (ns=0; ns < amount; ns++) document.write("<LAYER NAME='n"+ns+"' LEFT=0 TOP=0><IMG SRC='"+images+"'></LAYER>"); function NsMouseFollow(evnt){ Xpos = evnt.pageX-5; Ypos = evnt.pageY-5; } window.onMouseMove = NsMouseFollow; } function Swirl(){ if (currStep<0.0550) step=0.001; if (document.all) { for (i=0;i<ieDiv.all.c.all.length;i++) { ieDiv.all.c.all[i].style.top = Ypos+cnter*Math.cos((currStep+i*4.5)/5)*Math.sin((currStep)*150); ieDiv.all.c.all[i].style.left = Xpos+cnter*Math.sin((currStep+i*4.5)/5)*Math.sin((currStep)*150); } } else if (document.layers) { for ( i = 0 ; i < ns ; i++ ) { var temp="n"+i document.layers[temp].top = Ypos+cnter*Math.cos((currStep+i*4.5)/5)*Math.sin((currStep)*150); document.layers[temp].left =Xpos+cnter*Math.sin((currStep+i*4.5)/5)*Math.sin((currStep)*150); } } currStep += step; setTimeout("Swirl()", 10); if (currStep>0.0540) { step+=0.002; if (document.layers) { for ( i = 0 ; i < ns ; i++ ) { var temp="n"+i document.layers[temp].top =Ypos+cnter*Math.cos((currStep+i*4.5)/5) document.layers[temp].left=Xpos+cnter*Math.sin((currStep+i*4.5)/5) } } else if (document.all) { for (i=0;i<ieDiv.all.c.all.length;i++) { ieDiv.all.c.all[i].style.top=Ypos+cnter*Math.cos((currStep+i*4.5)/5) ieDiv.all.c.all[i].style.left=Xpos+cnter*Math.sin((currStep+i*4.5)/5) } } } // 烈火網 liehuo.net 欢迎复制,拒绝恶意采集 liehuo.net if (step > 0.5) { step=0.5; cnter-=8; } if (document.layers) _y=-window.innerWidth; else if (document.all) _y=-document.body.clientWidth; if (cnter <= _y) { currStep=0; step=0.001; cnter=70; } } Swirl(); // --> </script> </body> </html> <br /><center>如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank'>http://www.veryhuo.com/</a></center>提示:可修改后代码再运行! 文章导航 图片站如何日入300元,讲述从做站到推广JavaScript 时钟代码,时间文字有倒影效果