Aller au contenu
Invision Board France
  • 0

flocon de neige


David

Question

Messages recommandés

  • 0

a placer dans <body>

 

<script language="JavaScript1.2">

<!-- Begin

var no = 30; // nombre de flocons

var speed = 10; // vitesse de chute des flocons

var snowflake = "snow.gif";

 

var ns4up = (document.layers) ? 1 : 0;  // speederich.com

var ie4up = (document.all) ? 1 : 0;

var dx, xp, yp;    // variables

var am, stx, sty;  // amplitude

var i, doc_width = 800, doc_height = 600;

if (ns4up) {

doc_width = self.innerWidth;

doc_height = self.innerHeight;

} else if (ie4up) {

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx = new Array();

xp = new Array();

yp = new Array();

am = new Array();

stx = new Array();

sty = new Array();

for (i = 0; i < no; ++ i) { 

dx= 0;                        // set coordinate variables

xp = Math.random()*(doc_width-50);  // set position variables

yp = Math.random()*doc_height;

am = Math.random()*20;      // set amplitude variables

stx = 0.02 + Math.random()/10; // set step variables

sty = 0.7 + Math.random();  // set step variables

if (ns4up) {                      // set layers

if (i == 0) {

document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\"></layer>");

} else {

document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\"></layer>");

}

} else if (ie4up) {

if (i == 0) {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"" + snowflake + "\" border=\"0\"></div>");

} else {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"" + snowflake + "\" border=\"0\"></div>");

      }

}

}

function snowNS() {  // Netscape main animation function

for (i = 0; i < no; ++ i) {  // iterate for every dot

yp += sty;

if (yp > doc_height-50) {

xp = Math.random()*(doc_width-am-30);

yp = 0;

stx = 0.02 + Math.random()/10;

sty = 0.7 + Math.random();

doc_width = self.innerWidth;

doc_height = self.innerHeight;

}

dx += stx;

document.layers["dot"+i].top = yp;

document.layers["dot"+i].left = xp + am*Math.sin(dx);

}

setTimeout("snowNS()", speed);

}

function snowIE() {  // IE main animation function

for (i = 0; i < no; ++ i) {  // iterate for every dot

yp += sty;

if (yp > doc_height-50) {

xp = Math.random()*(doc_width-am-30);

yp = 0;

stx = 0.02 + Math.random()/10;

sty = 0.7 + Math.random();

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx += stx;

document.all["dot"+i].style.pixelTop = yp;

document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);

}

setTimeout("snowIE()", speed);

}

if (ns4up) {

snowNS();

} else if (ie4up) {

snowIE();

}

// End -->

</script>

 

lien vers l'image -> http://www.speederich.com/Astucesjava/snow.gif

Modifié par TitaX
Lien vers le commentaire
Partager sur d’autres sites

  • 0

 

l'image était joint a mon poste

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Si vous avez besoin d'informations supplémentaires, n'hésitez pas à ouvrir un nouveau sujet ou à demander la réouverture de votre sujet par MP à un modérateur ou administrateur :)

 

Merci.

 

Ceci est une réponse automatique.

Lien vers le commentaire
Partager sur d’autres sites

  • 0

precision:

pour que ce script fonctionne sur vos forums (via le board wrapper par exemple), placer l'image dans le meme repertoire que le script. ou modifier le chemin :

<img src=\"" + snowflake + "\" border=\"0\"></layer>")
Lien vers le commentaire
Partager sur d’autres sites

  • 0

essayez une recherche avec des mots-cles comme 'neige', 'snow', 'flocon', 'snowflake', etc.

 

Soit via l'outil de Recherche de ces forums-ci, soit ailleurs (google.com, dynamicdrive.com, etc)

 

Google est ton ami. Ne pas oublier de lui faire une bise. ;)

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Ca marche plus ou moins !! J'ai un script que j ai pris sur ce site et ca fonctionne parfaitement sous mozilla, firefox, et IE

 

Le script

<script language="JavaScript1.2">

 

/******************************************

* Snow Effect Script- By Altan d.o.o. (snow@altan.hr, http://www.altan.hr/snow/index.html)

* Visit Dynamic Drive (http://www.dynamicdrive.com/) for full source code

* Modified Dec 31st, 02' by DD. This notice must stay intact for use

******************************************/

 

 

  //Configure below to change URL path to the snow image

  var snowsrc="http://deex2.free.fr/snow.gif"

  // Configure below to change number of snow to render

  var no = 10;

 

  var ns4up = (document.layers) ? 1 : 0;  // browser sniffer

  var ie4up = (document.all) ? 1 : 0;

  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

 

  var dx, xp, yp;    // coordinate and position variables

  var am, stx, sty;  // amplitude and step variables

  var i, doc_width = 1200, doc_height = 900;

 

  if (ns4up||ns6up) {

    doc_width = self.innerWidth;

    doc_height = self.innerHeight;

  } else if (ie4up) {

    doc_width = document.body.clientWidth;

    doc_height = document.body.clientHeight;

  }

 

  dx = new Array();

  xp = new Array();

  yp = new Array();

  am = new Array();

  stx = new Array();

  sty = new Array();

 

  for (i = 0; i < no; ++ i) { 

    dx = 0;                        // set coordinate variables

    xp = Math.random()*(doc_width-50);  // set position variables

    yp = Math.random()*doc_height;

    am = Math.random()*20;        // set amplitude variables

    stx = 0.02 + Math.random()/10; // set step variables

    sty = 0.7 + Math.random();    // set step variables

    if (ns4up) {                      // set layers

      if (i == 0) {

        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><a href=\"http://dynamicdrive.com/\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/layer>");

      } else {

        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"><\/layer>");

      }

    } else if (ie4up||ns6up) {

      if (i == 0) {

        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");

      } else {

        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");

      }

    }

  }

 

  function snowNS() {  // Netscape main animation function

    for (i = 0; i < no; ++ i) {  // iterate for every dot

      yp += sty;

      if (yp > doc_height-50) {

        xp = Math.random()*(doc_width-am-30);

        yp = 0;

        stx = 0.02 + Math.random()/10;

        sty = 0.7 + Math.random();

        doc_width = self.innerWidth;

        doc_height = self.innerHeight;

      }

      dx += stx;

      document.layers["dot"+i].top = yp;

      document.layers["dot"+i].left = xp + am*Math.sin(dx);

    }

    setTimeout("snowNS()", 10);

  }

 

  function snowIE_NS6() {  // IE and NS6 main animation function

    for (i = 0; i < no; ++ i) {  // iterate for every dot

      yp += sty;

      if (yp > doc_height-50) {

        xp = Math.random()*(doc_width-am-30);

        yp = 0;

        stx = 0.02 + Math.random()/10;

        sty = 0.7 + Math.random();

        doc_width = ns6up?window.innerWidth : document.body.clientWidth;

        doc_height = ns6up?window.innerHeight : document.body.clientHeight;

      }

      dx += stx;

      if (ie4up){

      document.all["dot"+i].style.pixelTop = yp;

      document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);

      }

      else if (ns6up){

      document.getElementById("dot"+i).style.top=yp;

      document.getElementById("dot"+i).style.left=xp + am*Math.sin(dx);

      } 

    }

    setTimeout("snowIE_NS6()", 10);

  }

 

  if (ns4up) {

    snowNS();

  } else if (ie4up||ns6up) {

    snowIE_NS6();

  }

 

</script>

 

<table width="93%" border="0" cellspacing="0">

<tr>

<td width="30" background="style_images/<#IMG_DIR#>/pop1.gif"> </td>

<td bgcolor="#FFFFFF"><div id="ipbwrapper">

 

<% BOARD HEADER %>

<% NAVIGATION %>

<% BOARD %>

<br>

<% COPYRIGHT %>

 

</div></td>

 

<td width="30" background="style_images/<#IMG_DIR#>/pop2.gif"> </td>

  </tr>

 

</table>

 

Le seul hic est que lorsque je le passe sur mon site ca marche mais que sur IE et pas mozilla et firefox...

 

Mon site

 

Le script d'origine est sur cette page et mon naviguateur mozilla l'affiche parfaitement

 

DynamicLite

 

ya t'il un dévelopeur dans la salle ? LOL

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Tien j'ai un code qui passe sous Firefox et IE

 

Copier ce code à l'emplacement désiré:

<script type="text/javascript" language="javascript1.2"><!--

 

//Edit the next few lines to suit your page. Recommended values are:

//numFlakes = 10; downSpeed = 0.01; lrFlakes = 10;

 

var pictureSrc = '/neige/snowflake.gif'; //the location of the snowflakes

var pictureWidth = 20;            //the width of the snowflakes

var pictureHeight = 20;          //the height of the snowflakes

var numFlakes = 10;              //the number of snowflakes

var downSpeed = 0.01;            //the falling speed of snowflakes (portion of screen per 100 ms)

var lrFlakes = 10;                //the speed that the snowflakes should swing from side to side

                                //relative to distance fallen (swing increases with fewer

                                //snowflakes to fill available space)

 

//--></script>

<script src="/Votre_repertoire/snowscript.js" type="text/javascript" language="javascript1.2"></script>

 

Puis faire un fichier nommé snowscript.js à l'endroit désiré

/****** Do not edit below this line unless you know what you are doing ******/

 

//safety checks. Browsers will hang if this is wrong. If other values are wrong there will just be errors

if( typeof( numFlakes ) != 'number' || Math.round( numFlakes ) != numFlakes || numFlakes < 1 ) { numFlakes = 10; }

 

//draw the snowflakes

for( var x = 0; x < numFlakes; x++ ) {

if( document.layers ) { //releave NS4 bug

document.write('<layer id="snFlkDiv'+x+'"><img src="'+pictureSrc+'" height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*" border="0"></layer>');

} else {

document.write('<div style="position:absolute;" id="snFlkDiv'+x+'"><img src="'+pictureSrc+'" height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*" border="0"></div>');

}

}

 

//calculate initial positions (in portions of browser window size)

var xcoords = new Array(), ycoords = new Array(), snFlkTemp;

for( var x = 0; x < numFlakes; x++ ) {

xcoords[x]= ( x + 1 ) / ( numFlakes + 1 );

do { snFlkTemp = Math.round( ( numFlakes - 1 ) * Math.random() );

} while( typeof( ycoords[snFlkTemp] ) == 'number' );

ycoords[snFlkTemp] = x / numFlakes;

}

 

//now animate

function flakeFall() {

if( !getRefToDivNest('snFlkDiv0') ) { return; }

var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0;

//find screen settings for all variations. doing this every time allows for resizing and scrolling

if( typeof( window.innerWidth ) == 'number' ) { scrWidth = window.innerWidth; scrHeight = window.innerHeight; } else {

if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

  scrWidth = document.documentElement.clientWidth; scrHeight = document.documentElement.clientHeight; } else {

  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

  scrWidth = document.body.clientWidth; scrHeight = document.body.clientHeight; } } }

if( typeof( window.pageYOffset ) == 'number' ) { scrollHeight = pageYOffset; scrollWidth = pageXOffset; } else {

if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { scrollHeight = document.body.scrollTop; scrollWidth = document.body.scrollLeft; } else {

  if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrollHeight = document.documentElement.scrollTop; scrollWidth = document.documentElement.scrollLeft; } }

}

//move the snowflakes to their new position

for( var x = 0; x < numFlakes; x++ ) {

if( ycoords[x] * scrHeight > scrHeight - pictureHeight ) { ycoords[x] = 0; }

var divRef = getRefToDivNest('snFlkDiv'+x); if( !divRef ) { return; }

if( divRef.style ) { divRef = divRef.style; } var oPix = document.childNodes ? 'px' : 0;

divRef.top = ( Math.round( ycoords[x] * scrHeight ) + scrollHeight ) + oPix;

divRef.left = ( Math.round( ( ( xcoords[x] * scrWidth ) - ( pictureWidth / 2 ) ) + ( ( scrWidth / ( ( numFlakes + 1 ) * 4 ) ) * ( Math.sin( lrFlakes * ycoords[x] ) - Math.sin( 3 * lrFlakes * ycoords[x] ) ) ) ) + scrollWidth ) + oPix;

ycoords[x] += downSpeed;

}

}

 

//DHTML handlers

function getRefToDivNest(divName) {

if( document.layers ) { return document.layers[divName]; } //NS4

if( document[divName] ) { return document[divName]; } //NS4 also

if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera)

if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4

return false;

}

 

window.setInterval('flakeFall();',100);

 

En revanche pour les flocons faudra les faires ou les trouvers sur un site web

Modifié par Jack Bauer
Lien vers le commentaire
Partager sur d’autres sites

  • 0
Tien j'ai un code qui passe sous Firefox et IE

 

Copier ce code à l'emplacement désiré:

 

QUOTE

<script type="text/javascript" language="javascript1.2"><!--

 

//Edit the next few lines to suit your page. Recommended values are:

//numFlakes = 10; downSpeed = 0.01; lrFlakes = 10;

 

var pictureSrc = '/neige/snowflake.gif'; //the location of the snowflakes

var pictureWidth = 20;            //the width of the snowflakes

var pictureHeight = 20;          //the height of the snowflakes

var numFlakes = 10;              //the number of snowflakes

var downSpeed = 0.01;            //the falling speed of snowflakes (portion of screen per 100 ms)

var lrFlakes = 10;                //the speed that the snowflakes should swing from side to side

                                //relative to distance fallen (swing increases with fewer

                                //snowflakes to fill available space)

 

//--></script>

<script src="/Votre_repertoire/snowscript.js" type="text/javascript" language="javascript1.2"></script>

 

 

Puis faire un fichier nommé snowscript.js à l'endroit désiré

 

QUOTE

/****** Do not edit below this line unless you know what you are doing ******/

 

//safety checks. Browsers will hang if this is wrong. If other values are wrong there will just be errors

if( typeof( numFlakes ) != 'number' || Math.round( numFlakes ) != numFlakes || numFlakes < 1 ) { numFlakes = 10; }

 

//draw the snowflakes

for( var x = 0; x < numFlakes; x++ ) {

if( document.layers ) { //releave NS4 bug

document.write('<layer id="snFlkDiv'+x+'"><img src="'+pictureSrc+'" height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*" border="0"></layer>');

} else {

document.write('<div style="position:absolute;" id="snFlkDiv'+x+'"><img src="'+pictureSrc+'" height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*" border="0"></div>');

}

}

 

//calculate initial positions (in portions of browser window size)

var xcoords = new Array(), ycoords = new Array(), snFlkTemp;

for( var x = 0; x < numFlakes; x++ ) {

xcoords[x]= ( x + 1 ) / ( numFlakes + 1 );

do { snFlkTemp = Math.round( ( numFlakes - 1 ) * Math.random() );

} while( typeof( ycoords[snFlkTemp] ) == 'number' );

ycoords[snFlkTemp] = x / numFlakes;

}

 

//now animate

function flakeFall() {

if( !getRefToDivNest('snFlkDiv0') ) { return; }

var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0;

//find screen settings for all variations. doing this every time allows for resizing and scrolling

if( typeof( window.innerWidth ) == 'number' ) { scrWidth = window.innerWidth; scrHeight = window.innerHeight; } else {

if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

  scrWidth = document.documentElement.clientWidth; scrHeight = document.documentElement.clientHeight; } else {

  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

  scrWidth = document.body.clientWidth; scrHeight = document.body.clientHeight; } } }

if( typeof( window.pageYOffset ) == 'number' ) { scrollHeight = pageYOffset; scrollWidth = pageXOffset; } else {

if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { scrollHeight = document.body.scrollTop; scrollWidth = document.body.scrollLeft; } else {

  if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrollHeight = document.documentElement.scrollTop; scrollWidth = document.documentElement.scrollLeft; } }

}

//move the snowflakes to their new position

for( var x = 0; x < numFlakes; x++ ) {

if( ycoords[x] * scrHeight > scrHeight - pictureHeight ) { ycoords[x] = 0; }

var divRef = getRefToDivNest('snFlkDiv'+x); if( !divRef ) { return; }

if( divRef.style ) { divRef = divRef.style; } var oPix = document.childNodes ? 'px' : 0;

divRef.top = ( Math.round( ycoords[x] * scrHeight ) + scrollHeight ) + oPix;

divRef.left = ( Math.round( ( ( xcoords[x] * scrWidth ) - ( pictureWidth / 2 ) ) + ( ( scrWidth / ( ( numFlakes + 1 ) * 4 ) ) * ( Math.sin( lrFlakes * ycoords[x] ) - Math.sin( 3 * lrFlakes * ycoords[x] ) ) ) ) + scrollWidth ) + oPix;

ycoords[x] += downSpeed;

}

}

 

//DHTML handlers

function getRefToDivNest(divName) {

if( document.layers ) { return document.layers[divName]; } //NS4

if( document[divName] ) { return document[divName]; } //NS4 also

if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera)

if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4

return false;

}

 

window.setInterval('flakeFall();',100);

 

 

jme demande ou insere le contenue du premier ???? dans kelle dosier

Modifié par saltoman
Lien vers le commentaire
Partager sur d’autres sites

  • 0
Tien j'ai un code qui passe sous Firefox et IE

 

Copier ce code à l'emplacement désiré:

Puis faire un fichier nommé snowscript.js à l'endroit désiré

En revanche pour les flocons faudra les faires ou les trouvers sur un site web

Bonjour;

 

est ce qu'il est possible de limiter la neige sur la page index du forum????

 

merci :wub:

Lien vers le commentaire
Partager sur d’autres sites

  • 0

oui ensuite sa marche mais les flocon safiche pas

 

et osi eske je pourai avoir le script original du ipb v 2.0.2 car le Powered by Invision Power Board v2.0.2 © 2004 IPS, Inc.

c mit en haut :s je sais pas comment faire pour le remtre en bas merci

Modifié par saltoman
Lien vers le commentaire
Partager sur d’autres sites

  • 0
et osi eske je pourai avoir le script original du ipb v 2.0.2 car le Powered by Invision Power Board v2.0.2 © 2004  IPS, Inc.

c mit en haut :s je sais pas comment faire pour le remtre en bas merci

 

 

bonjour,

Suffit de vous logguer dans votre espace client et de vous rendre dans votre centre de téléchargement.

Lien vers le commentaire
Partager sur d’autres sites

Rejoindre la conversation

Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.

Invité
Répondre à cette question…

×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

Chargement
×
×
  • Créer...

Information importante

En utilisant ce site, vous êtes d’accords avec nos Conditions d’utilisation. Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookies, sinon nous supposerons que vous êtes d’accord pour continuer.