$(function() {
var size = {
height : $(document).height(),
width : $(document).width()
};
function DrawDrop() {
var drop = $("
", {
"class" : "raindrop",
css : {
left : Math.random() * size.width,
top : Math.random() * size.height
}
}).appendTo(document.body);
var dropSize = Math.random() * 100;
drop.animate({
height : dropSize,
width : dropSize,
opacity : 0,
left : "-=" + (dropSize / 2) + "px",
top : "-=" + (dropSize / 2) + "px"
}, Math.random() * 500 + 500, function() {
drop.remove();
DrawDrop();
});
}
for (var i=0; i<100; i++) {
setTimeout(function() {
DrawDrop();
}, Math.random() * 1000);
}
});