Show Falling Christmas Snow on your Blogs!


imageWhat can be more delightful than welcoming your blog visitors with falling snow. The script that we would use today is provided by dynamic drive and creates an animated effect. The snow smoothly falls down the page and then disappears. We can control the number of snow balls and also the time after which they should disappear. You can easily replace the snow image with any image you prefer. The installation as always is kept extremely easy. Lets add some falling snow to our blogger blogs!


Live Demo



Show Colorful Falling Snow on Blogspot

  1. Go To Blogger > Design
  2. Choose HTML/Javascript gadget
  3. Paste the following code inside it,

<script type="text/javascript">

  
  //Configure below to change URL path to the snow image
  var snowsrc="http://3.bp.blogspot.com/--hEgrJEXAzo/Tt-5f_2SzAI/AAAAAAAAFi8/Uf-VH61UbDY/s400/snow.gif"
  // Configure below to change number of snow to render
  var no = 15;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

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

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "http://3.bp.blogspot.com/--hEgrJEXAzo/Tt-5f_2SzAI/AAAAAAAAFi8/Uf-VH61UbDY/s400/snow.gif" : snowsrc
  for (i = 0; i < no; ++ i) { 
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
        if (ie4up||ns6up) {
      if (i == 0) {
        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>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
        doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

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

if (ie4up||ns6up){
    snowIE_NS6();
        if (hidesnowtime>0)
        setTimeout("hidesnow()", hidesnowtime*1000)
        }

</script>

Make these changes:

  • To set the number of snow balls edit the number 15
  • To change the snow image replace the bolded link with yours

If you want use white soft snow rather than snow flakes then use this link:

http://3.bp.blogspot.com/-0l_0DkjlekY/Tt-6P7Vam3I/AAAAAAAAFjI/ht10gKN3-Ys/s400/falling-snow.png

Why not some red colorful snow?

http://4.bp.blogspot.com/-dXJl9LoEelg/Tt-9kfMN51I/AAAAAAAAFjs/SxvC4NpLQQI/s400/red-snow.png      

You can replace the image with anything you wish. You can display falling autumn leaves, falling new year message,falling diamonds or even falling  hearts! Just play with the code and keep changing the flavours.

4.  Save your widget and drag it to the top most position possible near header as shown below,

drag gadget near navbar

 

 

 

   5. Click the orange save button on your page elements and you are all done!

Save button

Visit your blogs to see beautiful snow falling on your blog giving a Christmas touch of winter. Have fun! :)

Need Quick Help within 24 Hours? ASK NOW



If you don't want to get yourself into Serious Technical Trouble while editing your Blog Template then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your order details by Clicking Here »

25 comments : Post Yours! Read Comment Policy ▼
PLEASE NOTE:
We have Zero Tolerance to Spam. Chessy Comments and Comments with 'Links' will be deleted immediately upon our review.

  1. You have one too! :)

    I posted one yesterday and mine runs on jQuery. Pretty nice effect! You should take a look.

    ReplyDelete
  2. thats great, while i browse the mbt lab for a live demo of cute subscrption box , i relize that why the snow is falling at mbt lab , then some taught come to my mind that may its a new trick , while a was thinking of it , then a few hour later when i got the email from feed burner then i remind oh so it was snow falling a part of this tutorial

    ReplyDelete
  3. I received this error:
    Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
    XML error message: The entity name must immediately follow the '&' in the entity reference.

    I highlighted from open script to close script, and pasted it at the top of the html box. Am I supposed to paste it in a specific section?

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. @Fern ...and actually, when I go to blogger>design, I get a button that says, "Edit HTML" but nothing that says HTML/Javascript. Is this something different?

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. @Fern
    You have to click on add gadget, not edit html.

    ReplyDelete
  8. Nice article.Instruction are also useful.Thank you for sharing.

    ReplyDelete
  9. @Brenosilver oh wow! That really is cool. Thank you.

    ReplyDelete
  10. Thank you very much my friend for your visit, good weekend with happiness & peace. Hugs Valter.

    ReplyDelete
  11. what the facility does not affect the loading blog? thanks for your share :)

    ReplyDelete
  12. no wonder my friend's blog has snow falling down.. it's cool..

    http://wrozlie.com

    ReplyDelete
  13. This comment has been removed by a blog administrator.

    ReplyDelete
  14. @Homebiss
    You can share some of your widgets at mbt any time buddy. :)


    @Faiz
    I always apply it first to lab and then write a tutorial on it. Feels great that you often visit the lab pal. :>

    @Fern
    Please do this:
    1) Go To Blogger > Design > Page Elements
    2) Click on "Add a Gadget"
    3) From the widgets, select HTML/Javascript widget
    4) Paste the code inside it
    5) Save the widget and drag it to header
    6) Hit the Save button towards your right

    Done! :)

    ReplyDelete
  15. Nice. I saw this on wordpress.com and was wondering how to do it.

    ReplyDelete
  16. I love this script, thank you so much, I was wondering if there's a way to change the speed of the falling snow? It's a bit slow for me. Thank you.

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Nice thinking, cool work. if you can edit this to fall snow every time. keep going

    ReplyDelete
  19. I have a problem. The snow only falls on the right side of my blog. Any way to fix?

    ReplyDelete
  20. i use this trick on my Rare SMS Blog and its look like so cool

    ReplyDelete
  21. Thanks for sharing excellent informations. Your website is so cool. I’m impressed by the details that you have on this blog. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for extra articles.
    zahnarzt implantate berlin

    ReplyDelete
  22. i have a question. How can i change the speed of falling snow ?

    ReplyDelete
  23. Same question- is there a way to speed it up?

    ReplyDelete