Countdown animation

HTML:

<span class="countdown">500</span>

jQuery:

var $count = $('.countdown');

var num = parseInt($count.text());
var interval = window.setInterval(updateTime, 1000);

function updateTime() {
  num--;
  $count.text(num.toString());
  if (num <= 0) {
    window.clearInterval(interval);
  }
}

Leave a Reply

Your email address will not be published.