Zero Progress Bar

Zero Progress Bar

I want to set the data-max of my progress bar to zero but doing this causes the progress bar to count 'til infinity (100 divided by zero). How can I set my progress bar to zero?

Here is my HTML:

  1. <progress class="progressbar" value="0" max="100" data-max="1"></progress>

I link to jquery and modernizr.

Here is my javascript:

  1.     $(document).ready(function() {

  2.       $('.progressbar').each(function() {
  3.         var progressbar = $(this),
  4.           progressbarValue = progressbar.next(),
  5.           value = progressbar.data('min') || 0,
  6.           max = progressbar.data('max'),
  7.  time = (100 / max) * 5,
  8.           value = progressbar.val(),
  9.           animate = setInterval(loading, time);

  10.         function loading() {
  11.           value += 1;
  12.           progressbar.val(value);
  13.           progressbarValue.html(value + '%');
  14.           if (value == max) {
  15.             clearInterval(animate);
  16.           }
  17.         };
  18.       })
  19.     });