In this example we set a number of parameters to demonstrate the veratility of jSnow 1.1! Look at the code and I will explain every parameter in detail afterwards.
Code used in this example of jSnow version 1.1:
$(function() {
});
$().jSnow({flakes:15, flakeMaxSize:30, flakeMinSize:20, flakeCode:["♦","ghost1.gif","ghost2.gif","ghost3.gif","ghost4.png"], flakeColor:["#f00","#00f","#fff"],interval:30});
flakes:15 I've set the number of snowflakes to 15, instead of 30 which is the default.flakeMaxSize:30 Maximum size of flakes in case we use HTML character code instead of images. This parameter will be ignored in case you have set images for snowflakes.flakeMinSize:20 Minimum size of flakes in case we use HTML character code instead of images. This parameter will be ignored in case you have set images for snowflakes.flakeCode:["♦","ghost1.gif","ghost2.gif","ghost3.gif","ghost4.png"]
Instead of using the default HTML code for flakes (• which results in •) I have an array of 5 items, 4 images and 1 html code. jSnow will select randomly from this selection. Three things are important here. A) ONLY gif and png images are suported. B) Set the full path to image (either relative or full path) in this example images are in the same directory as the html file so no need to set a path. C) flakeMaxSize, flakeMinSize and flakeColor parameters are only applied for HTML elements that you have set in flakeCode. So if you've used just images, don't bother to set these 3 parameters since jSnow cannot effect the color of the image :). Image support was added in version 1.1 of jSnow.flakeColor:["#f00","#00f","#fff"] A random selection of array of colors to be applied to HTML code snow flakes (ignored in images).interval:30 Control the interval loops of the animation. The default value is 50 (milliseconds) which means that the animation loop will run every 50ms (20 times per seconds, since 1 sec = 1000 milliseconds). Since we set it in a lower value the animation loop will run more times in a second so it will be faster. I suggest not changing this parameter unless you fully understand intervals and browser performance. This feature was added in version 1.1 of jSnow
jSnow, a jQuery Plugin
v 1.1 All Browsers Supported.IE6+, Opera, Safari, Firefox & Chrome Licensed under GPL licenses.
Copyright (C) 2009 Nikos "DuMmWiaM" Kontis, dummwiam@gmail.com
http://www.DuMmWiaM.com/jSnow
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.