How to add the Glitter Effect Mouse Pointer to your Blog

The code for this tweak is javascript. All you need to do is to add the javascript code to your template but only within the head (<head></head>) tag. You may visit kantahanan lyrics blog for demo.

The Code:

<script type="text/javascript">
// <![CDATA[
var colour="#666666";
var sparkles=40;

var x=ox=400;
var y=oy=300;
var swide=800;
var shigh=600;
var sleft=sdown=0;
var tiny=new Array();
var star=new Array();
var starv=new Array();
var starx=new Array();
var stary=new Array();
var tinyx=new Array();
var tinyy=new Array();
var tinyv=new Array();
window.onload=function() { if (document.getElementById) {
var i, rats, rlef, rdow;
for (var i=0; i<sparkles; i++) {
var rats=createDiv(3, 3);
rats.style.visibility="hidden";
document.body.appendChild(tiny[i]=rats);
starv[i]=0;
tinyv[i]=0;
var rats=createDiv(5, 5);
rats.style.backgroundColor="transparent";
rats.style.visibility="hidden";
var rlef=createDiv(1, 5);
var rdow=createDiv(5, 1);
rats.appendChild(rlef);
rats.appendChild(rdow);
rlef.style.top="2px";
rlef.style.left="0px";
rdow.style.top="0px";
rdow.style.left="2px";
document.body.appendChild(star[i]=rats);
}
set_width();
sparkle();
}}
function sparkle() {
var c;
if (x!=ox || y!=oy) {
ox=x;
oy=y;
for (c=0; c<sparkles; c++) if (!starv[c]) {
star[c].style.left=(starx[c]=x)+"px";
star[c].style.top=(stary[c]=y)+"px";
star[c].style.clip="rect(0px, 5px, 5px, 0px)";
star[c].style.visibility="visible";
starv[c]=50;
break;
}
}
for (c=0; c<sparkles; c++) {
if (starv[c]) update_star(c);
if (tinyv[c]) update_tiny(c);
}
setTimeout("sparkle()", 40);
}
function update_star(i) {
if (--starv[i]==25) star[i].style.clip="rect(1px, 4px, 4px, 1px)";
if (starv[i]) {
stary[i]+=1+Math.random()*3;
if (stary[i]<shigh+sdown) {
star[i].style.top=stary[i]+"px";
starx[i]+=(i%5-2)/5;
star[i].style.left=starx[i]+"px";
}
else {
star[i].style.visibility="hidden";
starv[i]=0;
return;
}
}
else {
tinyv[i]=50;
tiny[i].style.top=(tinyy[i]=stary[i])+"px";
tiny[i].style.left=(tinyx[i]=starx[i])+"px";
tiny[i].style.width="2px";
tiny[i].style.height="2px";
star[i].style.visibility="hidden";
tiny[i].style.visibility="visible"
}
}
function update_tiny(i) {
if (--tinyv[i]==25) {
tiny[i].style.width="1px";
tiny[i].style.height="1px";
}
if (tinyv[i]) {
tinyy[i]+=1+Math.random()*3;
if (tinyy[i]<shigh+sdown) {
tiny[i].style.top=tinyy[i]+"px";
tinyx[i]+=(i%5-2)/5;
tiny[i].style.left=tinyx[i]+"px";
}
else {
tiny[i].style.visibility="hidden";
tinyv[i]=0;
return;
}
}
else tiny[i].style.visibility="hidden";
}
document.onmousemove=mouse;
function mouse(e) {
set_scroll();
y=(e)?e.pageY:event.y+sdown;
x=(e)?e.pageX:event.x+sleft;
}
function set_scroll() {
if (typeof(self.pageYOffset)=="number") {
sdown=self.pageYOffset;
sleft=self.pageXOffset;
}
else if (document.body.scrollTop || document.body.scrollLeft) {
sdown=document.body.scrollTop;
sleft=document.body.scrollLeft;
}
else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
sleft=document.documentElement.scrollLeft;
sdown=document.documentElement.scrollTop;
}
else {
sdown=0;
sleft=0;
}
}
window.onresize=set_width;
function set_width() {
if (typeof(self.innerWidth)=="number") {
swide=self.innerWidth;
shigh=self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth) {
swide=document.documentElement.clientWidth;
shigh=document.documentElement.clientHeight;
}
else if (document.body.clientWidth) {
swide=document.body.clientWidth;
shigh=document.body.clientHeight;
}
}
function createDiv(height, width) {
var div=document.createElement("div");
div.style.position="absolute";
div.style.height=height+"px";
div.style.width=width+"px";
div.style.overflow="hidden";
div.style.backgroundColor=colour;
return (div);
}
// ]]>
</script>


If you like this post, please subscribe:

Email:

74 comments:

  See Yes Vj

June 24, 2009 8:27 AM

how do I add a text box like, Subscribe if you like my post, in every blog post like you. Kindly mail me thisisvj@gmail.com

  bluedreamer27

June 26, 2009 10:13 AM

i once tried webfetti.com

Top Five

  shant

June 26, 2009 8:24 PM

back visit.
nice articel

  kikamz

July 1, 2009 6:01 AM

hello chester! this is cool!

btw, kindly update the link URL for the blog JUST ABOUT ANYTHING from http://seasons.pinoyvibes.net/ to my new URL: http://www.kikamzpera.com/. thanks!

  O Homem da Conspiração

July 1, 2009 3:30 AM

I think that this effect is a bit gay. LOL

  2sweetnsaxy

July 2, 2009 12:57 AM

Nice tip. I may have to try that. Thanks for the visit and the comment.
:-)

  Kim

July 2, 2009 12:18 AM

nice effect Hapi :)

  LACED OUT!

July 14, 2009 5:45 AM

great blog, I just learned so many things after reading a couple of pages!

The Brown Kid Blog

  Ide Gokil

July 11, 2009 9:11 PM

nice info, thx ur visit

  Silentwords

July 12, 2009 10:25 PM

I Want to link Exchange with You If You Would Find it Worth Then please Let me Know My Blog is Title :- Results | Jobs | Tax Notifications URL http://fundigg.blogspot.com/ With A Page Rank of 2. Leave a Comment on My Blog With Your URL & Title of Blog. Thanks & Regards

  Ria

July 11, 2009 1:11 AM

Thanks for sharing this.

  Carlos

July 10, 2009 10:41 PM

Hi,thank you for the visit.Happy weekend.

  Ide Gokil

July 8, 2009 7:50 PM

wow good info. thx 4 ur visit friend

  Mad Hatter

July 6, 2009 9:48 AM

thats cute !!

  Samantha

July 9, 2009 2:43 AM

Hello back to you Chester :)

  indian.stock.market.talk

July 6, 2009 2:16 PM

Nice article ! Thanks for the visit and comment !

http://trade-indian-stock-market.blogspot.com/

  Buttercup

July 5, 2009 5:44 AM

Cooool..

  O Seu Livre Arbítrio

July 5, 2009 9:05 PM

Hi, thanks for the visiting. Nice effects. :D

See you!

  sioukee

July 6, 2009 7:13 AM

Very interesting blog :)

  JANIZ

July 5, 2009 10:19 PM

hi! just updating my blog list!

  attayaya

July 20, 2009 12:10 AM

is it make heavy loading?

  Az-1

July 15, 2009 9:23 PM

Hi,

Nice info. Thanks for visiting my blogs.

Azwan
http://HotSiries.com
http://VideoLah.com
http://lawak-jenaka.blogspot.com

  shanCHIH{;

July 15, 2009 5:06 AM

Hello hello :) Thanks for dropping by my blog and even leaving a message!

ShanChih

  John Lottery

July 16, 2009 12:17 PM

Great Posts on your blog. Keep it up!

  Raphael C. Lima

September 26, 2009 9:11 PM

nice effect.
thanks for the visit.

  Tony

September 15, 2009 8:26 PM

hey thanks, good site :-)

  Andrea

September 8, 2009 7:58 PM

Great blog!!!

Thank you for stopping by my place. I hope you will return soon.

Andrea

  Domonyi Károly

September 26, 2009 6:03 PM

Hi,

Your site is one of my favorites seen around blog explosion. Keep up the good work.
I enjoy reading your blog. It is great to find someone who can find the fun things in life!
I wish you all the best in all years. I look forward to developing a friendship and networking with you.
Take a look at my websites AriesTrade Network in Europe.

With Regards,
Karoly Domonyi
http://www.twitter.com/AriesNetwork

  Dani Oliveira.

September 10, 2009 6:09 AM

Thanks to your visit, Hapi! I hope you can come back!

Nice blog yours, too!
Have a nice day!

=*

  Raquel

September 5, 2009 8:37 AM

interesting points...
just visiting too :]
see u

  Raquel

September 5, 2009 8:36 AM

interesting points...
just visiting too :]
see u

  Henrique Rodriguez

September 14, 2009 11:56 AM

hELLO
http://novidadesautomotivas.blogspot.com/

  angelshair

September 20, 2009 2:12 AM

I love that effect!! Thanks for the code!

  TiSport.blogspot.com

September 14, 2009 8:02 AM

Hi, thanks for the visiting.

  Lisa

September 20, 2009 3:21 PM

You have an interesting blog!

  Marga Fuentes

September 6, 2009 2:22 PM

Hello, thanks for visit my blog.
Your blog is very interesting.
Kiss

  Key

September 9, 2009 4:54 AM

i try this

  Mari

September 27, 2009 7:33 PM

how do you do?
I'm just backing your visit.
Back in my place when you want. Brazilian doors are'll always open!
kisses
=***

  Aku Bisa!

September 21, 2009 1:16 PM

Ass.Sebelumnya Q ngin ngucapin "Andai jemari tak sempat berjabat.
Jika raga tak bisa bersua.
Bila Ada kata membekas luka.
Semoga pintu maaf masih terbuka.
Selamat Idul Fitri" Q dah Linkback nih.. Linkback y.. Dah bisa di cek ko'. Q tunggu backlinknya. Trims. Ass

  jUnE0u

August 29, 2009 7:43 AM

wew...awesome !

  shengmarie

August 25, 2009 5:15 PM

i visited, hello there!

  jesse

August 27, 2009 6:22 AM

what a useful post :)
anytime? visit my blog
thanks

  Zanil Hyder

August 22, 2009 10:10 AM

Thank you for the visit and comment.

please do visit my profile and visit my blogs and suggest me how i could improve them. i am trying a hand in a few different areas all of them in separate blogs.

  meralkisa

August 30, 2009 12:56 PM

thanks for visiting :)

  saaZ

August 24, 2009 9:49 PM

wow, nice post..

regards,
HapiBlog

  uosland

August 25, 2009 2:27 PM

back viset u have nice blog too iwant help from u plz can u give how i add html for window player

  chicoelho

August 28, 2009 12:08 PM

Hi Thanks for your visit and comments,your blog and always very nice.

regard

  Maple

August 22, 2009 7:17 PM

Good Job!

  Z

August 25, 2009 5:01 AM

cool blog
thx for visiting!

  leathergloves

August 24, 2009 5:39 PM

Hi Hapi

Thanks for visiting my blog. I have also put in a link at my Blogger Templates 123 blog which also shares about templates, tips and tricks about blogging http://blogger-templates123.blogspot.com

  Panda Attack

August 23, 2009 6:08 PM

hapi blogging to you too : D


P.S.
awesome blog!

  Twin Endeavors

August 30, 2009 7:52 AM

Thanks so much for dropping by my blog (if you forget which blog was mine, see my link below). I'm so glad you took the time to comment on my blog! It prompted me to head over to your blog to check it out and I saw your post on the sparkles blog effect and LOVE it!!

http://nocostcashfromhome.blogspot.com

It was so easy to copy the code and paste it into my blogs HTML. Not only do I like the effect, but I'm betting that my visitors will hang around a few seconds longer than they normally might have just to check out the effect.

If you'd be OK with it, I'd like to put a link on my blog to this post. Please e-mail me at debbie at twinendeavors dot com and let me know it is OK.

Thanks so much Hapi!!

REMINDER TO ALL BLOGGING / HTML NEWBIES -
ALWAYS save your blogs HTML code BEFORE revising or adding to it. Copy and paste the HTML into a notepad or wordpad to your hard drive(MS Word didn't work from me - probably due to some auto formatting that it does that notepad / wordpad doesn't do). This way if your blog isn't functioning as it should or if it "blows up", you can always revert back to your original HTML code. Trust me, I learned that lesson the hard way!!

  Cafeína

August 28, 2009 1:35 AM

tks for your visit in www.bebendo.com.br

Good blog, unfortunetly my english is too bad to get te SEO Book, ´cause I would like...

kiss

  Blogs Creativos

August 18, 2009 6:03 AM

gracias

  Tuareg

August 17, 2009 2:02 PM

Hi!

Thanks for the visit at http://espaciomixto.blogspot.com and, as you said... "happy blogging". :-)

  Anup

August 19, 2009 8:52 PM

i've subscribed to your post Now send me that ebook please. send it to my email adress ramkajikayastha@yahoo.com thanx. u have a nice blog

  autumn

August 16, 2009 3:28 AM

Nice, nice. :D

  pendi

August 17, 2009 3:14 AM

thank a lot about the info...

i'll try

  mascherano-2008

August 17, 2009 2:47 PM

www.pes--edit.blogspot.com

  sundeep

August 22, 2009 12:11 AM

Thankx for commenting , I have bookmarked your blog.I will surely test your code!!

  requeri

August 21, 2009 1:02 PM

obrigada pela visita.

  içimden geldiği gibi ~~~

August 13, 2009 5:59 AM

thanks Hapi !!!

  Information

August 11, 2009 6:02 AM

Very nice.

  Umbul

August 9, 2009 11:05 PM

Usefull post, Please leave your comment on my new blog at http://popularbook-id.blogspot.com/

  Mademoiselle Frou-Frou

August 5, 2009 4:50 PM

this is so cute - i never thought of adding that!
xox
www.froufroufashionista.blogspot.com

  Redynne™

August 8, 2009 1:16 AM

hi..there..

thanx so much for sharing.. nice effect..

do visit my blog for some sparkling ya.. ;)

www.fixingabrokenheart-redynne.blogspot.com

  Phaelun

July 30, 2009 10:07 PM

wow, i find ur site very useful :) i would like to exchange links with you? do you mind?

www.phaelun.com

  Mary

July 28, 2009 4:54 PM

Hello!
Thanks for visiting my blog

  blogadmin

July 30, 2009 7:14 PM

Thnax for visiting at http://albumlirik.blogspot.com

:)

  JW

July 24, 2009 8:34 AM

Cool! nice tips

  attayaya

July 22, 2009 5:36 AM

selamat malam semuanya

buka name/urlnya dong

  engineer

July 21, 2009 8:33 PM

thanks for the visit htt://www.juan3.com. If you have time add me to your blogroll. .. :)

  *.:✿*゚Karina‘゚・✿.:*

September 29, 2009 10:26 AM

Thank you for visited my blog.
Have a nice day~!!!