Learning While Aging

Add winter touch to your web site

Since it is December and I am in the northern part, I figure it is time to add a little winter touch to my web site, so I added some snow flakes flying down on my web site. Have you noticed it (well, the snow only comes in December, and keep reading to find out why)? If you want to know how to do it on your web site, here is how.

1. Go to www.dynamicdrive.com to get the snow effect JavaScript code and the snow flake picture.

2. Copy and paste the JavaScript to the <body> section of your web site, and remember to change the image source of the snow flake picture to the location where you saved it. And it is done! Now refresh your web site and you will see the snow flakes flying down on your web site.

[If you use WordPress like I do, you can add the script in your header.php file by using the Editor in your current WordPress theme.]

So far the result is very satisfactory. But I want more. I would like the snow effect only be available in December, after that the snow should stop automatically, so I added a little JavaScript check for the month before loading the snow effect. Here is the final script looks like:

   1: var d = new Date();

   2: var m = d.getMonth();

   3: if (m == 11)

   4: {

   5:     // Copy and paste the JavaScript

   6:     // you downloaded

   7: }

That is. Next month the snow effect will go away by itself, and next December, it will start again by itself and I don’t have do anything!

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x