Domanda

Hi I'm using the jQuery countdown from Keith Wood (http://keith-wood.name/countdownRef.html) and I would like to know how I reset the counter when someone refreshes the page. So every time someone enters the page he must see: 00days 3hours 13min 19sec

I'm a complete newbie with jQuery. I make use of jquery.countdown.min.js file.

Please help. I have this now as JS:

    /* jQuery countdown init */
    $('#countdown').countdown({
        layout: '<div class="span3 counter-block"><span id="days-num">{dn}</span><h4 id="days-desc">{dl}</h4></div>' +
                '<div class="span3 counter-block"><span id="hours-num">{hn}</span><h4 id="hours-desc">{hl}</h4></div>' +
                '<div class="span3 counter-block"><span id="min-num">{mn}</span><h4 id="min-desc">{ml}</h4></div>' +
                '<div class="span3 counter-block"><span id="sec-num">{sn}</span><h4 id="sec-desc">{sl}</h4></div>',
        until: '+00d +3h +13m +19s')
    });
});

and HTML:

<div id="countdown" class="row"></div>

But it is not showing What am I doing wrong?

È stato utile?

Soluzione

Assuming you always want 3hrs, 13min, 19sec from now use:

$(selector).countdown({until: '+3h +13m +19s'}); 
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top