Somethinghitme

Code, demos and ideas.

jQuery Snowfall 1.5 update now with snow buildup!

October 06, 2011

Check out the new version here, with the ability to add images to snowflakes!

Repo on Github Download Jquery Snowfall 1.5 View the plugin in action

Added snow buildup to the plugin, so now you can pass a jquery selector in the collection option and the snow will collect on top of all the elements matched. It uses the canvas tag so the snow wont collect in IE8 or lower. To enable collection you can do the following

[sourcecode language=“js”] snowfall({collection : ‘element’}); [/sourcecode]

Element can be either a class or id or a list such as

[sourcecode language=“js”] $(document).snowfall({collection : ‘.elements’}); $(document).snowfall({collection : ‘#element’}); [/sourcecode]

Thats pretty much it for new options below is the standard way of using the plugin.

Invoking the snow

[sourcecode language=“js”] $(document).snowfall(); $(‘#elementid’).snowfall({flakeCount : 100, maxSpeed : 10}); $(‘.class’).snowfall({flakeCount : 100, maxSpeed : 10}); [/sourcecode]

Snowfall Methods

[sourcecode language=“js”] // stopping the snow $(document).snowfall(‘clear’); $(‘#elementid’).snowfall(‘clear’); $(‘.class’).snowfall(‘clear’); [/sourcecode]

Options currently supported with default values

[sourcecode language=“js”] options = { flakeCount : 35, // number flakeColor : ‘#ffffff’, // string flakeIndex: 999999, // number minSize : 1, // number maxSize : 3, // number minSpeed : 2, // number maxSpeed : 3, // number round : false, // bool shadow : false, // bool collection : ‘element’ // string }; [/sourcecode]

Example


Written by Jason Brown Father, Veteran, lover of everything tech.