Advertisement
rhiby

script love blogger ^_^

Feb 14th, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. //Configure below to change URL path to the snow image
  4. var snowsrc="http://lh5.ggpht.com/_O3Mkjo7Ekyo/SjF22CmjbjI/AAAAAAAAA3o/yByfvwhYwuw/_br04.gif"
  5. // Configure below to change number of snow to render
  6. var no = 15;
  7. // Configure whether snow should disappear after x seconds (0=never):
  8. var hidesnowtime = 0;
  9. // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  10. var snowdistance = "pageheight";
  11. ///////////Stop Config//////////////////////////////////
  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; // coordinate and position variables
  18. var am, stx, sty; // amplitude and step variables
  19. var i, doc_width = 800, doc_height = 600;
  20.  
  21. if (ns6up) {
  22. doc_width = self.innerWidth;
  23. doc_height = self.innerHeight;
  24. } else if (ie4up) {
  25. doc_width = iecompattest().clientWidth;
  26. doc_height = iecompattest().clientHeight;
  27. }
  28. dx = new Array();
  29. xp = new Array();
  30. yp = new Array();
  31. am = new Array();
  32. stx = new Array();
  33. sty = new Array();
  34. snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "http://3.bp.blogspot.com/--hEgrJEXAzo/Tt-5f_2SzAI/AAAAAAAAFi8/Uf-VH61UbDY/s400/snow.gif" : snowsrc
  35. for (i = 0; i < no; ++ i) {
  36. dx[i] = 0; // set coordinate variables
  37. xp[i] = Math.random()*(doc_width-50); // set position variables
  38. yp[i] = Math.random()*doc_height;
  39. am[i] = Math.random()*20; // set amplitude variables
  40. stx[i] = 0.02 + Math.random()/10; // set step variables
  41. sty[i] = 0.7 + Math.random(); // set step variables
  42. if (ie4up||ns6up) {
  43. if (i == 0) {
  44. 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>");
  45. } else {
  46. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
  47. }
  48. }
  49. }
  50. function snowIE_NS6() { // IE and NS6 main animation function
  51. doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  52. doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
  53. for (i = 0; i < no; ++ i) { // iterate for every dot
  54. yp[i] += sty[i];
  55. if (yp[i] > doc_height-50) {
  56. xp[i] = Math.random()*(doc_width-am[i]-30);
  57. yp[i] = 0;
  58. stx[i] = 0.02 + Math.random()/10;
  59. sty[i] = 0.7 + Math.random();
  60. }
  61. dx[i] += stx[i];
  62. document.getElementById("dot"+i).style.top=yp[i]+"px";
  63. document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
  64. }
  65. snowtimer=setTimeout("snowIE_NS6()", 10);
  66. }
  67. function hidesnow(){
  68. if (window.snowtimer) clearTimeout(snowtimer)
  69. for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  70. }
  71.  
  72. if (ie4up||ns6up){
  73. snowIE_NS6();
  74. if (hidesnowtime>0)
  75. setTimeout("hidesnow()", hidesnowtime*1000)
  76. }
  77. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement