Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.58 KB | None | 0 0
  1. <body>
  2.  
  3. <script type="text/javascript">
  4.             // nom et lien de l'image
  5.             var snowsrc="full.png"
  6.             // Nombre d'images
  7.             var no = 50;
  8.             // Durée de l'effet
  9.             var hidesnowtime = 0;
  10.             // "windowheight" or "pageheight"
  11.             var snowdistance = "pageheight";
  12.             var ie4up = (document.all) ? 1 : 0;
  13.             var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
  14.             function iecompattest(){
  15.                 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  16.            }
  17.            var dx, xp, yp;
  18.             var am, stx, sty;
  19.             var i, doc_width = screen.width, doc_height = screen.height;
  20.             if (ns6up) {
  21.                 doc_width = self.innerWidth;
  22.                 doc_height = self.innerHeight;
  23.             } else if (ie4up) {
  24.                 doc_width = iecompattest().clientWidth;
  25.                 doc_height = iecompattest().clientHeight;
  26.             }
  27.             dx = new Array();
  28.             xp = new Array();
  29.             yp = new Array();
  30.             am = new Array();
  31.             stx = new Array();
  32.             sty = new Array();
  33.             for (i = 0; i < no; ++ i) {
  34.                dx[i] = 0;
  35.                xp[i] = Math.random()*(doc_width-50);
  36.                yp[i] = Math.random()*doc_height;
  37.                am[i] = Math.random()*20;
  38.                stx[i] = 0.02 + Math.random()/10;
  39.                sty[i] = 0.5 + Math.random();
  40.                if (ie4up||ns6up) {
  41.                    if (i == 0) {
  42.                        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><\/div>");
  43.                     } else {
  44.                         document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\" height=\"15\"><\/div>");
  45.                     }
  46.                 }
  47.             }
  48.             function snowIE_NS6() {  // IE and NS6 main animation function
  49.                 doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  50.                 doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
  51.                 for (i = 0; i < no; ++ i) {
  52.                    yp[i] += sty[i];
  53.                    if (yp[i] > doc_height-50) {
  54.                         xp[i] = Math.random()*(doc_width-am[i]-30);
  55.                         yp[i] = 0;
  56.                         stx[i] = 0.02 + Math.random()/10;
  57.                         sty[i] = 0.5 + Math.random();
  58.                     }
  59.                     dx[i] += stx[i];
  60.                     document.getElementById("dot"+i).style.top=yp[i]+"px";
  61.                     document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
  62.                 }
  63.                 snowtimer=setTimeout("snowIE_NS6()", 10);
  64.             }
  65.             function hidesnow(){
  66.                 if (window.snowtimer) clearTimeout(snowtimer)
  67.                 for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  68.            }
  69.            if (ie4up||ns6up){
  70.                snowIE_NS6();
  71.                if (hidesnowtime>0)
  72.                     setTimeout("hidesnow()", hidesnowtime*1000)
  73.             }
  74.         </script>
  75.  
  76. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement