FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


SnowScript





alone
A Snowscript you can simply add tot all your pages/forums etc.

simply ad this line to your page

CODE
<script language="JavaScript" src="yourwebsite/snow.js"></script>

if you want to add it to your forum, just add it to the page_header

and store this code as "snow.js" on your webserver

CODE
<!-- Snow Script by Niels Chr. Rĝd (dec 2003)
Y = new Array();
X = new Array();
S = new Array();
A = new Array();
B = new Array();
M = new Array();
V = (document.layers)?1:0;

iH=(V)?window.innerHeight:window.document.body.clientHeight;
iW=(V)?window.innerWidth:window.document.body.clientWidth;
N = Math.round(iH*iW/20000)+1; //Number of snow balls, initially 40

for (i=0; i < N; i++){ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Y[i]=Math.round(Math.random()*iH);
X[i]=Math.round(Math.random()*iW);
S[i]=Math.round(Math.random()*4+1); //Speed of snow, initially as 5+2
A[i]=0;
B[i]=Math.random()*0.1+0.1;
M[i]=Math.round(Math.random()*2+1); //Size of snow ball, initially at 1+1
}
if (V){
for (i = 0; i < N; i++)
{document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FAFAF0' CLIP='0,0,"+M[i]+","+M[i]+"'></LAYER>")}
}
else{
document.write('<div style="position:absolute;top:0px;left:0px">');
document.write('<div style="position:relative">');
for (i = 0; i < N; i++)
{document.write('<div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#FAFAF0;font-size:'+M[i]+'"></div>')}
document.write('</div></div>');
}

function snow(){
var H=(V)?window.innerHeight:window.document.body.clientHeight;
var W=(V)?window.innerWidth:window.document.body.clientWidth;
var T=(V)?window.pageYOffset:document.body.scrollTop;
var L=(V)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < N; i++){
sy=S[i]*Math.sin(Math.PI/2); // 90*Math.PI/180)
sx=S[i]*Math.cos(A[i])+0.2;
Y[i]+=sy;
X[i]+=sx;
if (Y[i] > H){
Y[i]=-10;
X[i]=Math.round(Math.random()*W);
M[i]=Math.round(Math.random()*2+1);
S[i]=Math.round(Math.random()*4+1);
}
if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}
else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}
A[i]+=B[i];
}
setTimeout('snow()',N+10); //timeout initially 10
}
simplyw00x
Please, please, never use this. It is possibly the most annoying thing possibly on a webpage. It makes your site look unprofessional and childish, and prevents the easy reading of your content. A nice idea, alone, but not for usage like you describe.
meangurl
who needs another annoying javascript? true, javascripts are good but some are just plain stupid, and on top of that, it makes your page slower too!

most noobs find it cool, just something to apply their so called "new discovery" but if you're planning a real site, that's a big no-no.
mathiaus
I think were agreed these 'effects' are just simply annoying and put people off visiting your site therefore are bad!
Also this code looks like its just been copied from somewhere else. (sorry if it hasnt)
Related topics
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.