Pagina 1 di 1

effetto neve rivisitato

Inviato: 12/12/2014, 20:15
da ugo76
Vi allego effetto neve rivisitato che ho metto sul mio forum nella pagina principale

ecco il link dove poterlo vedere clicca qui

Codice: Seleziona tutto

<script type="text/javascript">
  var snowsrc="http://s17.postimg.org/xefefzlnv/cav_Nat_copia.png"
  var snowsrc2="http://s27.postimg.org/fgithwbsf/stella.png"
  var snowsrc3="http://s18.postimg.org/69pmvz2id/fiocco.png"
  var snowsrc4="http://s3.postimg.org/lt6rgzd6n/AN644.gif"
  var snowsrc5="http://www.andromedafree.it/tuttonatale/gifanimatenatalizie/upgrade2/ultimoanno/02/19.gif"

  var no2 = 15;
  var hidesnowtime = 0;
  var snowdistance = "windowheight";

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

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

  var dx2, xp2, yp2;    // coordinate and position variables
  var am2, stx2, sty2;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up2) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up2) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx2 = new Array();
  xp2 = new Array();
  yp2 = new Array();
  am2 = new Array();
  stx2 = new Array();
  sty2 = new Array();
  snowsrc2=(snowsrc2.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc2
  for (i = 0; i < no2; ++ i) { 
    dx2[i] = 0;                        // set coordinate variables
    xp2[i] = Math.random()*(doc_width-50);  // set position variables
    yp2[i] = Math.random()*doc_height;
    am2[i] = Math.random()*20;         // set amplitude variables
    stx2[i] = 0.02 + Math.random()/10; // set step variables
    sty2[i] = 0.7 + Math.random();     // set step variables
      if (ie4up2||ns6up2) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
       }
       if (i == 2) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc5+"' border=\"0\"><\/a><\/div>");
      }
       if (i == 3) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      }
       if (i == 4) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc5+"' border=\"0\"><\/a><\/div>");
      }
       if (i == 5) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      }
       if (i == 6) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc5+"' border=\"0\"><\/a><\/div>");
      }
       if (i == 7) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      }

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

  function snowIE_NS62() {  // IE and NS6 main animation function
    doc_width = ns6up2?window.innerWidth-10 : iecompattest().clientWidth-10;
      doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up2 && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up2 && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no2; ++ i) {  // iterate for every dot
      yp2[i] += sty2[i];
      if (yp2[i] > doc_height-50) {
        xp2[i] = Math.random()*(doc_width-am2[i]-30);
        yp2[i] = 0;
        stx2[i] = 0.02 + Math.random()/10;
        sty2[i] = 0.7 + Math.random();
      }
      dx2[i] += stx2[i];
      document.getElementById("dot"+i).style.top=yp2[i]+"px";
      document.getElementById("dot"+i).style.left=xp2[i] + am2[i]*Math.sin(dx2[i])+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS62()", 12);
  }

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

if (ie4up2||ns6up2){
    snowIE_NS62();
      if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*100)
      }
</script>