installer une pluie d'images

2 participants

Voir le sujet précédent Voir le sujet suivant Aller en bas

Résolu installer une pluie d'images

Message par didou408 Ven 29 Juil 2011 - 19:12

Bonjour !

Voilà mon soucis, je n'arrive pas a enregistrer ou a renommer en .js !
C'est sur ce tuto :https://forum.forumactif.com/t220393-avoir-une-pluie-d-images-sur-son-forum?highlight=pluie

Merci


Dernière édition par didou408 le Lun 1 Aoû 2011 - 9:27, édité 1 fois
avatar

didou408
**

Féminin
Messages : 84
Inscrit(e) le : 06/04/2009

http://non-au-silence.forumactif.com
didou408 a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par Invité Ven 29 Juil 2011 - 19:18

Bonjour,

Avez-vous essayé de placer votre code dans:
Panneau d'admin > Modules > Gestions des codes Javascript ?
Créez un nouveau code javascript, nommez-le comme vous voulez, cochez soit "Sur l'index" soit "Sur toutes les pages", et coller votre code en dessous, puis validez.

Cordialement.
Anonymous

Invité
Invité


Invité a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par didou408 Ven 29 Juil 2011 - 19:19

Ben je peux pas avoir mon code car je peux pas l'héberger !
Comme je ne peux pas l'enregistrer en .js
quand je vais sur le site de l'hébergeur cela ne fonctionne pas.
avatar

didou408
**

Féminin
Messages : 84
Inscrit(e) le : 06/04/2009

http://non-au-silence.forumactif.com
didou408 a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par Invité Ven 29 Juil 2011 - 19:23

Avec le chemin que je vous ai indiqué, il n'y a pas besoin d'héberger votre code en .js, c'est votre forum qui s'en charge. Cette nouveauté: > https://forum.forumactif.com/t308422-nouveaute-forumactif-gestion-des-codes-javascript
a simplifié l'utilisation des codes javascript pour tous les utilisateurs. Vous n'aurez rien à placer dans la description du site ou le message d'accueil.

Cordialement.
Anonymous

Invité
Invité


Invité a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par didou408 Ven 29 Juil 2011 - 19:24

Oui j'ai essaye ca ne marche pas !
Code:
// Indiquer l'URL de l'image du flocon :
    var urlflocon="http://www.victoronline.be/images/Disney-Cars-Luigi.jpg"
    // Ecrire le nombre de flocons :
    var nombreflocons = 5;
    // Indiquer si la neige doit disparaître après x secondes (0=jamais) :
    var cacherflocons = 0;
    // Indiquer si la neige doit être vue sur la fenêtre ou toute la page avant de disparaître ("windowheight"=la fenêtre, "pageheight"=toute la page)
    var voirflocons = "pageheight";

    /////////// FIN DE LA PARTIE CONFIGURATION //////////////////////////////////

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

    function testIEcompatible(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    var dx, xp, yp; // Variables de coordonnées et de position
    var am, stx, sty; // Variables d'amplitude
    var i, doc_width = 1024, doc_height = 768; // Taille de l'écran

    if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
    } else if (ie4up) {
    doc_width = testIEcompatible().clientWidth;
    doc_height = testIEcompatible().clientHeight;
    }

    dx = new Array();
    xp = new Array();
    yp = new Array();
    am = new Array();
    stx = new Array();
    sty = new Array();

    for (i = 0; i < nombreflocons; ++ i) {
    dx[i] = 0; // Variables de coordonnées
    xp[i] = Math.random()*(doc_width-50); // Variables de position
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20; // Variables d'amplitude
    stx[i] = 0.02 + Math.random()/10; // Variables de pas
    sty[i] = 0.7 + Math.random(); // Variables de pas
    if (ie4up||ns6up) {
    if (i == 0) {
    document.write("<div id="dot"+ i +"" style="POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;"><img src='"+urlflocon+"' border="0"></div>");
    } else {
    document.write("<div id="dot"+ i +"" style="POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;"><img src='"+urlflocon+"' border="0"></div>");
    }
    }
    }

    function neigeIE_NS6() { // IE et NS6 : fonctions principales d'animation
    doc_width = ns6up?window.innerWidth-10 : testIEcompatible().clientWidth-10;
    doc_height=(window.innerHeight && voirflocons=="windowheight")? window.innerHeight : (ie4up && voirflocons=="windowheight")? testIEcompatible().clientHeight : (ie4up && !window.opera && voirflocons=="pageheight")? testIEcompatible().scrollHeight : testIEcompatible().offsetHeight;
    for (i = 0; i < nombreflocons; ++ i) { // déplacement pour chaque point ("dot")
    yp[i] += sty[i];
    if (yp[i] > doc_height-50) {
    xp[i] = Math.random()*(doc_width-am[i]-30);
    yp[i] = 0;
    stx[i] = 0.02 + Math.random()/10;
    sty[i] = 0.7 + Math.random();
    }
    dx[i] += stx[i];
    document.getElementById("dot"+i).style.top=yp[i]+"px";
    document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
    }
    snowtimer=setTimeout("neigeIE_NS6()", 10);
    }

    function cacherneige(){
    if (window.snowtimer) clearTimeout(snowtimer)
    for (i=0; i<nombreflocons; i++) document.getElementById("dot"+i).style.visibility="hidden"
    }

    if (ie4up||ns6up){
    neigeIE_NS6();
    if (cacherflocons>0)
    setTimeout("cacherneige()", cacherflocons*1000)
    }
avatar

didou408
**

Féminin
Messages : 84
Inscrit(e) le : 06/04/2009

http://non-au-silence.forumactif.com
didou408 a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par Alex Fowl Ven 29 Juil 2011 - 20:15

Bonjour,

Et ce code :
Code:
 //Configure below to change URL path to the snow image
  var snowsrc="http://www.victoronline.be/images/Disney-Cars-Luigi.jpg"
  // Configure below to change number of snow to render
  var no = 10;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

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

   function iecompattest(){
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
   }

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("fdf.aidactif.fr")!=-1)? "http://www.victoronline.be/images/Disney-Cars-Luigi.jpg" : snowsrc
  for (i = 0; i < no; ++ i) { 
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;        // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();    // set step variables
      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://fdf.aidactif.fr\"><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 snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
      doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

   function hidesnow(){
      if (window.snowtimer) clearTimeout(snowtimer)
      for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
   }
      

if (ie4up||ns6up){
    snowIE_NS6();
      if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*1000)
      }
Smile

Cordialement,
avatar

Alex Fowl
Membre actif

Masculin
Messages : 7557
Inscrit(e) le : 28/03/2009

Alex Fowl a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par didou408 Sam 30 Juil 2011 - 12:30

Non ca ne marche pas !
avatar

didou408
**

Féminin
Messages : 84
Inscrit(e) le : 06/04/2009

http://non-au-silence.forumactif.com
didou408 a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par Invité Sam 30 Juil 2011 - 12:42

Bonjour,

J'ai réussi à faire fonctionner le script donné par Alex Fowl en me servant de ce site pour le rendre compatible.
J'ai placé le code ci dessous dans mon panneau d'administration > Modules > Gestions des codes javascript.
Code:
var snowsrc="http://www.victoronline.be/images/Disney-Cars-Luigi.jpg",no=10,hidesnowtime=0,snowdistance="pageheight",ie4up=document.all?1:0,ns6up=document.getElementById&&!document.all?1:0;function iecompattest(){return document.compatMode&&document.compatMode!="BackCompat"?document.documentElement:document.body}var dx,xp,yp,am,stx,sty,i,doc_width=800,doc_height=600;if(ns6up)doc_width=self.innerWidth,doc_height=self.innerHeight;else if(ie4up)doc_width=iecompattest().clientWidth,doc_height=iecompattest().clientHeight;
dx=[];xp=[];yp=[];am=[];stx=[];sty=[];snowsrc=snowsrc.indexOf("fdf.aidactif.fr")!=-1?"http://www.victoronline.be/images/Disney-Cars-Luigi.jpg":snowsrc;
for(i=0;i<no;++i)if(dx[i]=0,xp[i]=Math.random()*(doc_width-50),yp[i]=Math.random()*doc_height,am[i]=Math.random()*20,stx[i]=0.02+Math.random()/10,sty[i]=0.7+Math.random(),ie4up||ns6up)i==0?document.write('<div id="dot'+i+'" style="POSITION: absolute; Z-INDEX: '+i+'; VISIBILITY: visible; TOP: 15px; LEFT: 15px;"><a href="http://fdf.aidactif.fr"><img src=\''+snowsrc+'\' border="0"></a></div>'):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 snowIE_NS6(){doc_width=ns6up?window.innerWidth-10:iecompattest().clientWidth-10;doc_height=window.innerHeight&&snowdistance=="windowheight"?window.innerHeight:ie4up&&snowdistance=="windowheight"?iecompattest().clientHeight:ie4up&&!window.opera&&snowdistance=="pageheight"?iecompattest().scrollHeight:iecompattest().offsetHeight;for(i=0;i<no;++i)yp[i]+=sty[i],yp[i]>doc_height-50&&(xp[i]=Math.random()*(doc_width-am[i]-30),yp[i]=0,stx[i]=0.02+Math.random()/10,sty[i]=0.7+Math.random()),dx[i]+=
stx[i],document.getElementById("dot"+i).style.top=yp[i]+"px",document.getElementById("dot"+i).style.left=xp[i]+am[i]*Math.sin(dx[i])+"px";snowtimer=setTimeout("snowIE_NS6()",10)}function hidesnow(){window.snowtimer&&clearTimeout(snowtimer);for(i=0;i<no;i++)document.getElementById("dot"+i).style.visibility="hidden"}if(ie4up||ns6up)snowIE_NS6(),hidesnowtime>0&&setTimeout("hidesnow()",hidesnowtime*1E3);
Le code fonctionne très bien, comme vous pourrez le constater sur mon forum test . Votre image est très grande, mais ce n'est que mon avis Wink .

Cordialement.
Anonymous

Invité
Invité


Invité a été remercié(e) par l'auteur de ce sujet.

Résolu Re: installer une pluie d'images

Message par didou408 Lun 1 Aoû 2011 - 9:27

Merci ca marche j'ai changé d'image !
avatar

didou408
**

Féminin
Messages : 84
Inscrit(e) le : 06/04/2009

http://non-au-silence.forumactif.com
didou408 a été remercié(e) par l'auteur de ce sujet.

Voir le sujet précédent Voir le sujet suivant Revenir en haut


Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum