1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Zero Progress Bar

Discussion in 'jQuery' started by makamo66, Oct 5, 2016.

  1. #1
    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:

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

    I link to jquery and modernizr.

    Here is my javascript:

    $(document).ready(function() {

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

    function loading() {
    value += 1;
    progressbarValue.html(value + '%');
    if (value == max) {
    makamo66, Oct 5, 2016 IP
  2. Einheijar

    Einheijar Well-Known Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Seems like all you need to do is reset value to 0, check your form in chrome/firebug to see if the value dynamically updated. Also using code tags would be immeasurably appreciated by those who you wish to ask for help from.
    Einheijar, Oct 5, 2016 IP