Snow Falling with script of Nikos Kontis v.1.1.mod1
Compatible with jQuery 2 and symbolic snowflakes are added.
by spmbt
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
v.1.1.mod1
CSS
body{background: #679; color: #8ac;}
JavaScript
//Notice how some of the images are repeated? That's handy for increasing the frequency of some types of snow flakes.
//And, here's the source:
// jSnow, a jQuery Plugin v1.1.mod1
// Licensed under GPL licenses.
// Copyright (C) 2009 Nikos "DuMmWiaM" Kontis, [email protected]
// http://www.DuMmWiaM.com/jSnow
// Modified 2009~
(function ($) {
$.fn.jSnow = function (h) {
var j = $.extend({},
$.fn.jSnow.defaults, h);
var k, WIN_HEIGHT;
setWaH();
var l = j.flakes;
var m = j.flakeCode;
var n = j.flakeColor;
var o = j.flakeMinSize;
var p = j.flakeMaxSize;
var q = j.fallingSpeedMin;
var r = j.fallingSpeedMax;
var s = j.interval;
var t = j.zIndex;
var useGif = false;
var u = $("<div \/>");
u.css({
width: k + "px",
height: 1,
display: "block",
overflow: "visible",
position: "absolute",
top: $("html").scrollTop() + 1 + "px",
left: "1px",
zIndex: t
});
$("body").prepend(u).css({
height: "100%"
});
$("html").css({
"overflow-y": "scroll",
"overflow-x": "hidden"
}); var v = Array();
generateFlake(l, false);
setInterval(animateFlakes, s);
window.onresize = setWaH;
function setWaH() {
k = $('body').width();
WIN_HEIGHT = window.innerHeight || document.documentElement.clientHeight
WIN_HEIGHT -= 50;
};
window.onscroll = function () {
u.css({
top: $("html").scrollTop() + "px"
})
};
function generateFlake(a, b) {
a = a || 1;
b = b || false;
var i = 0;
for (i = 0; i < a; i++) {
var c = $("<span \/>");
var d = o + Math.floor(Math.random() * p);
var e = m[Math.floor(Math.random() * m.length)];
if (e.indexOf(".gif") != -1 ||...