Mettre de la neige sur son site/forum

Statut
N'est pas ouverte pour d'autres réponses.
D

deleted247906

Bonjour à tous !
Aujourd'hui un petit script pour vous permettre de faire en sorte qu'il neige sur votre forum.
<script type="text/javascript">
var no = 40;var delai = 10;
var dx = new Array(), xp = new Array(), yp = new Array();
var am = new Array(), stx = new Array(), sty = new Array();
var i;larg_fenetre = (document.body.offsetWidth<window.innerWidth)? window.innerWidth:document.body.offsetWidth;haut_fenetre = (document.body.offsetHeight<window.innerHeight)? window.innerHeight:document.body.offsetHeight;

for (i = 0; i < no; i++) {dx = 0;xp = Math.random()*(larg_fenetre-400);yp = Math.random()*haut_fenetre;am = Math.random()*20;stx = 0.02 + Math.random()/100;sty = 0.7 + Math.random();
obj = document.getElementsByTagName('body')[0];para = document.createElement("img");para.setAttribute("src","../images/neige.gif");para.setAttribute("id","dot" + i);para.style.position = "absolute";para.style.zIndex = "2";obj.appendChild(para);
}

function neige() {
for (i = 0; i < no; i++) {dx += stx;yp += sty;
if (yp > haut_fenetre-0.5) {xp = Math.random()*(larg_fenetre-am-40);yp = 0;
}document.getElementById("dot"+i).style.top = yp + "px";document.getElementById("dot"+i).style.left = xp + am*Math.sin(dx) + "px";
}setTimeout("neige()", delai);
}


Telechargez l'image (Elle est en 16x16 en haut à gauche)
 

Snake's

Administrateur
Ancien staff
Inscription
5 Juin 2012
Messages
8 792
Réactions
6 916
Points
29 965
RGCoins
0
Préfixe modifié.
 

MSLift

Premium
Inscription
5 Août 2013
Messages
833
Réactions
331
Points
16 996
RGCoins
0
Pourquoi ne pas mettre l'image en base64 ?
 

PerseusCW

Moddeur BO Cold War
Premium
Inscription
28 Mai 2013
Messages
3 400
Réactions
1 570
Points
17 286
RGCoins
0
Il y a 10000 fois plus simple.. x)
 
Statut
N'est pas ouverte pour d'autres réponses.
Haut