jQuery countdown serverSync for multiple countdowns

jQuery countdown serverSync for multiple countdowns

Hi,

I use jQuery CountDown on an auction website. There are multiple countdowns on the same page, and sometimes a countdown is updated (when a bid is made in the last 30 seconds of the countdown) via pusher.

The problem is that the countdown is not really reliable. When I open several navigators, there are some differences between the countdowns. Sometimes 3 or 4 seconds.

The options serverSync is used, but it seems that when the countdown is updated, the new value is not synchronized anymore ...

I would like to resync the coutwdowns each time a bid is made, or at a specific interval (every 5 seconds for example). Is there any way I can do that ?

Thx for your help,

G.

Here is the code I use for each countdowns (values comes from PHP) when the page is loaded :

  1. $(function () {
  2. $('#Countdown".$articles."').countdown({serverSync: serverTime,
  3.      until: $.countdown.UTCDate(+1, $y, $m-1, $d, $h, $min, $sec, 0), 
  4.      onTick: highlightLast5,
  5.      expiryText: '<div class=\"over\">Le vente est clôturée</div>',
  6.      onExpiry: liftOff".$articles."});
  7. $('#Countdown".$articles."').countdown($.countdown.regionalOptions['fr']);
  8. });

The code when I update the countdown :

  1. var t = $("#Countdown"+data.lot).countdown('getTimes');
  2. t[6] += 30;
  3. $("#Countdown"+data.lot).countdown('option', 'until', t[0] + 'y ' + t[1] + 'o ' + t[2] + 'w ' + t[3] + 'd ' + t[4] + 'h ' + t[5] + 'm ' + t[6] + 's');