Advertisement
piensosinpensar

COPOS DE NIEVE

Nov 30th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1.  
  2. COPIA EL CÓDIGO, ENTRA EN TU TUMBLR, "EDITAR TEMA" Y LUEGO EN EDITAR HTML
  3. Y VE AL FINAL DEL CODIGO DE TU TEMA Y PEGALO.
  4. *************************************************************************
  5.  
  6. <script type="text/javascript">
  7.  
  8. //Configure below to change URL path to the snow image
  9. var snowsrc="http://www.snazzyspace.com/tumblr/snowb.gif"
  10. // Configure below to change number of snow to render
  11. var no = 10;
  12. // Configure whether snow should disappear after x seconds (0=never):
  13. var hidesnowtime = 0;
  14. // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  15. var snowdistance = "pageheight";
  16.  
  17. ///////////Stop Config//////////////////////////////////
  18.  
  19. var ie4up = (document.all) ? 1 : 0;
  20. var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
  21.  
  22. function iecompattest(){
  23. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  24. }
  25.  
  26. var dx, xp, yp; // coordinate and position variables
  27. var am, stx, sty; // amplitude and step variables
  28. var i, doc_width = 800, doc_height = 600;
  29.  
  30. if (ns6up) {
  31. doc_width = self.innerWidth;
  32. doc_height = self.innerHeight;
  33. } else if (ie4up) {
  34. doc_width = iecompattest().clientWidth;
  35. doc_height = iecompattest().clientHeight;
  36. }
  37.  
  38. dx = new Array();
  39. xp = new Array();
  40. yp = new Array();
  41. am = new Array();
  42. stx = new Array();
  43. sty = new Array();
  44. snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  45. for (i = 0; i < no; ++ i) {
  46. dx[i] = 0; // set coordinate variables
  47. xp[i] = Math.random()*(doc_width-50); // set position variables
  48. yp[i] = Math.random()*doc_height;
  49. am[i] = Math.random()*20; // set amplitude variables
  50. stx[i] = 0.02 + Math.random()/10; // set step variables
  51. sty[i] = 0.7 + Math.random(); // set step variables
  52. if (ie4up||ns6up) {
  53. if (i == 0) {
  54. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://www.snazzyspace.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
  55. } else {
  56. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
  57. }
  58. }
  59. }
  60.  
  61. function snowIE_NS6() { // IE and NS6 main animation function
  62. doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  63. doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
  64. for (i = 0; i < no; ++ i) { // iterate for every dot
  65. yp[i] += sty[i];
  66. if (yp[i] > doc_height-50) {
  67. xp[i] = Math.random()*(doc_width-am[i]-30);
  68. yp[i] = 0;
  69. stx[i] = 0.02 + Math.random()/10;
  70. sty[i] = 0.7 + Math.random();
  71. }
  72. dx[i] += stx[i];
  73. document.getElementById("dot"+i).style.top=yp[i]+"px";
  74. document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
  75. }
  76. snowtimer=setTimeout("snowIE_NS6()", 10);
  77. }
  78.  
  79. function hidesnow(){
  80. if (window.snowtimer) clearTimeout(snowtimer)
  81. for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  82. }
  83.  
  84.  
  85. if (ie4up||ns6up){
  86. snowIE_NS6();
  87. if (hidesnowtime>0)
  88. setTimeout("hidesnow()", hidesnowtime*1000)
  89. }
  90.  
  91. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement