Snow Falling Simple with script of Nikos Kontis v.1.1.mod3.0
Simple Variant make effect in full window only (may be restricted by parameter 'height' in top of window). (Fiddle #2 is little more short.)
by spmbt
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
v.1.1.mod3.0 (Simple) <i>(2009+2015)</i><br><br><br><br>5<br><br><span class="toggleFalling">toggle_fall</span><br><br><br>10<br><br><br><br><br>15<br><br><br><br><br>20<br><br><br><br><br>25<br><br><br><br><br>30<br><br><br><br><br>35<br><br><br><br><br>40<br><br><br><br><br>45<br><br><br><br><br>50<br><br><br><br><br>
CSS
body{background: #679; color: #8ac;}
.toggleFalling{cursor: pointer; color: #fff}
JavaScript
// jSnowSimple, a jQuery Plugin v1.1mod3.0 falling in full window, 2009+2015. Licensed under GPL licenses.
// (c) 2009 Nikos "DuMmWiaM" Kontis, dummwiam@gmail.com
// upd Shadowmint (http://shadowmint.blogspot.com/) 2009
// upd Serban Boanca (http://www.dj50.ro/) 2010
// upd spmbt.github.com 2015
//more short than https://jsfiddle.net/spmbt/vhccLbzm/4/
$['fn']['jSnow'] = function(o, wW, wH){ //[''] are written for Closure Compiler
var $contOver = $('body')
,setWH = function(){
wW = $contOver.width();
wH = o.height || (window.innerHeight || document.documentElement.clientHeight) -20;
};
setWH();
var sN = o['flakes'] ||30 //default settings
,sCodes = o['flakeCode'] ||['•']
,sColors = o['flakeColor'] ||['#fff']
,sSizeMin = o['flakeMinSize']==null ? 10 : o['flakeMinSize']
,sSizeMax = o['flakeMaxSize'] ||20
,dYMin = 1+ (o['fallingSpeedMin']==null ? 1 : o['fallingSpeedMin'])
,dYMax = o['fallingSpeedMax'] ||3
,dT = o['interval'] ||50
,z = o['zIndex']==null ?'auto': o['zIndex']
,fadeAway = o['fadeAway'] //progressive transparency before hide
,fwS = o['followScroll'] //'fixed' support
,runFall = o['runFall']==null ? 1 : o['runFall'] //move on start and continue falling
,toggleFalling = o['toggleFalling'] ||'.toggleFalling' //selector for 'stop/continue' button
,$cont = $('<div \/>')['css']({ //container
width: wW,
height: 1,
display: 'block',
overflow: 'visible',
position: fwS ?'fixed':'absolute',
zIndex: z
})['prependTo']($contOver)
,S =[] //flakes
,moveFlakes = function(one){
for(var i = S.length; i--;){
var sI = S[i]
,sID = $['data'](sI);
sID.top = 0| sID.top + sID.dY;
sID.rad += 2;
if(sID.top > wH){
$['removeData'](sI);
S.splice(i, 1);
addFlakes(1,1);
}
sI['css']({
left: (sID.left0 - (Math.cos((sID.rad / 180) * Math.PI)) * sID.swingRange),
top: sID.top,
opacity: fadeAway ? Math.min((wH - sID.top) / 100, 1) : 1
});
}
!one && runFall && setTimeout(moveFlakes,...