loktar00 / JQuery-Snowfall

Makes it snow on any web page or specific element.
http://loktar00.github.io/JQuery-Snowfall/
712 stars 221 forks source link

Multiple Images? #22

Open iamlee opened 10 years ago

iamlee commented 10 years ago

Is there an easy way to add multiple images to the snow fall effect with an array within the image object?

iamlee commented 10 years ago

FYI i came up with a workaround using random numbers, this is the code i cam up with which seems to work fine, i just needed to rename my images to a generic name and appended a number to the end.

$('.snowfall-flakes').each(function(i, el){ var src = $(this).attr("src").split("."); var randomNumber = Math.floor(Math.random() * 5) + 1; var newSrc = src[0] + randomNumber + '.' + src[1];

      $(this).attr("src", newSrc);

});

Artaud commented 7 years ago

I am just initiating the snowfall multiple times with different image property and it works alright...