I created snowflakes in jquery. Creating and deleting a div can cause the script to not respond. Right now I tried jquery using animate() I want to generate flakes with 20 at the same time as the page is loading. I'm not sure when I tried this method it might cause this unresponsive value (browser is too slow)
Here is the new jquery code
function jquerysnow() { snowCount = 20; var snow = $('<div class="snow"></div>'); $('#snowflakes').prepend(snow); snowX = Math.floor(Math.random() * $('#snowflakes').width()); snowSpd = Math.floor(Math.random() * (500) * 20); snow.css({'left':snowX+'px'}); snow.html('*'); snow.animate({ top: "500px", opacity : "0", }, 2000, function(){ $(this).remove(); jquerysnow(); }); } jquerysnow();
See here fiddle
Now it shows one flake at a time, as soon as the flakes disappear, they are generated further. How can I generate multiple flakes without a script response.
javascript jquery html css
Vignesh pichamani
source share