Phiên bản đầy đủ: jsB@nk » Con trỏ » Pháo bông khi nhấp phải chuột
URL: https://www.javascriptbank.com/right-click-sparks.html
Hiệu ứng sẽ tạo một chùm pháo bông đơn giản ngay con trỏ chuột khi người dùng nhấp phải chuột.
Phiên bản đầy đủ: jsB@nk » Con trỏ » Pháo bông khi nhấp phải chuột
URL: https://www.javascriptbank.com/right-click-sparks.html
<script type="text/javascript"><!-- Begin/* Created by: Kenny Orovic :: http://www.geocities.com/ax_c/ */// size of Sparklervar s=80;// Sparkle size rangevar fs=1;var fb=30;// sparkle shape or textvar st="*";// blink rate (may affect time)var br=5;// blink time (may affect rate)var bt=70;// colorsvar cl=new Array("aaffee","ccff77","ffcc44","ffaa22","ffbb66","ffff88")// number of colorsvar nc=6;// fallow mouse (true or false)var fm = true;// Do not alter anything below/***************************************************/var bl=0;var bi=0;var a=s/2;blink=setInterval('blinker(0,0)', br);clearInterval(blink);function add(x,y){ clearInterval(blink); document.all.planet.style.visibility = "visible"; to=x; le=y; blink=setInterval('blinker(to,le)', br); bl=0;}function fallow(x,y){ to=x; le=y; clearInterval(blink); blink=setInterval('blinker(to,le)', br);}function blinker(x,y){ if(fm==true) document.onmousemove=new Function("fallow(event.x,event.y);return false") c=Math.floor(Math.random()*s); d=Math.floor(Math.random()*s); f=Math.floor(Math.floor(Math.random() * (fb - fs + 1) + fs)); document.all.planet.style.color=cl[bi]; document.all.planet.style.font=f+"px;"; document.all.planet.style.left=x-c+a; document.all.planet.style.top=y-d+a; bl=bl+1; bi=bi+1; if(bi==nc){ bi=0; } if(bl==bt){ clearInterval(blink); document.all.planet.style.visibility = "hidden"; document.all.planet.style.left=-s; document.all.planet.style.top=-s; document.all.planet.style.color=000000; document.all.planet.style.font=1+"px;"; document.onmousemove=new Function("return false") bl=0; }}document.oncontextmenu=new Function("add(event.x,event.y);return false")document.write("<span id=planet style=visibility:hidden;position:absolute;top:-80px;left:-80px>"+st+"</span>")// End --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->