Guest User

Untitled

a guest
Dec 9th, 2014
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3.  
  4.  
  5. var snowsrc="snow.gif"
  6.  
  7. var no = 10;
  8.  
  9. var hidesnowtime = 0;
  10.  
  11. var snowdistance = "pageheight";
  12.  
  13. ///////////Stop Config//////////////////////////////////
  14.  
  15. var ie4up = (document.all) ? 1 : 0;
  16. var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
  17.  
  18. function iecompattest(){
  19. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  20. }
  21.  
  22. var dx, xp, yp; // coordinate and position variables
  23. var am, stx, sty; // amplitude and step variables
  24. var i, doc_width = 800, doc_height = 600;
  25.  
  26. if (ns6up) {
  27. doc_width = self.innerWidth;
  28. doc_height = self.innerHeight;
  29. } else if (ie4up) {
  30. doc_width = iecompattest().clientWidth;
  31. doc_height = iecompattest().clientHeight;
  32. }
  33.  
  34. dx = new Array();
  35. xp = new Array();
  36. yp = new Array();
  37. am = new Array();
  38. stx = new Array();
  39. sty = new Array();
  40. snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  41. for (i = 0; i < no; ++ i) {
  42. dx[i] = 0; // set coordinate variables
  43. xp[i] = Math.random()*(doc_width-50); // set position variables
  44. yp[i] = Math.random()*doc_height;
  45. am[i] = Math.random()*20; // set amplitude variables
  46. stx[i] = 0.02 + Math.random()/10; // set step variables
  47. sty[i] = 0.7 + Math.random(); // set step variables
  48. if (ie4up||ns6up) {
  49. if (i == 0) {
  50. 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>");
  51. } else {
  52. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
  53. }
  54. }
  55. }
  56.  
  57. function snowIE_NS6() { // IE and NS6 main animation function
  58. doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  59. doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
  60. for (i = 0; i < no; ++ i) { // iterate for every dot
  61. yp[i] += sty[i];
  62. if (yp[i] > doc_height-50) {
  63. xp[i] = Math.random()*(doc_width-am[i]-30);
  64. yp[i] = 0;
  65. stx[i] = 0.02 + Math.random()/10;
  66. sty[i] = 0.7 + Math.random();
  67. }
  68. dx[i] += stx[i];
  69. document.getElementById("dot"+i).style.top=yp[i]+"px";
  70. document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
  71. }
  72. snowtimer=setTimeout("snowIE_NS6()", 10);
  73. }
  74.  
  75. function hidesnow(){
  76. if (window.snowtimer) clearTimeout(snowtimer)
  77. for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  78. }
  79.  
  80.  
  81. if (ie4up||ns6up){
  82. snowIE_NS6();
  83. if (hidesnowtime>0)
  84. setTimeout("hidesnow()", hidesnowtime*1000)
  85. }
  86.  
  87. </script>
Advertisement
Add Comment
Please, Sign In to add comment