Skip to content Skip to sidebar Skip to footer

End Javascript Function After 10 Seconds

I found a javascript snow script. Here is the fiddle: http://jsfiddle.net/wj2K4/ (very nice) Its only a gimmick and I don't want it dominating the page, so I want to turn it off

Solution 1:

Use s.stop(); to stop snow animations. See the code below, I used setTimeout to stop the animation

function doStart() {
  if (!s.excludeMobile || !isMobile) {
    if (s.freezeOnBlur) {
      s.events.add(isIE?document:window,'mousemove',doDelayedStart);
    } else {
      doDelayedStart();
    }
  }
  // event cleanup
  s.events.remove(window, 'load', doStart);
  setTimeout(function(){s.stop();},15000); //stop after 15 seconds
}

Demo: http://jsfiddle.net/muthkum/wj2K4/1/

Post a Comment for "End Javascript Function After 10 Seconds"