javascript - How to reload page when jquery.counter trigger finish.countdown event for multiple instance? -
i using multiple instance jquery countdown , implement page reload when counter finished e.g.
$('.countdown').each(function() { var $this = $(this), finaldate = $(this).data('countdown'); $this.countdown((finaldate), function(event) { var days = event.strftime('%d'); $(this).find('.days').children('span').html(days); $(this).find('.hours').children('span').html(event.strftime('%h')); $(this).find('.minutes').children('span').html(event.strftime('%m')); $(this).find('.seconds').children('span').html(event.strftime('%s')); }); $(this).on('finish.countdown', function(event){ /*if(!window.location.hash && !(window.location.hash.indexof('_loaded') > -1)) { window.location = window.location + '#_loaded'; window.location.reload(); }*/ //if put window location reload here goes infinite loop. above commented code reload page twice not valid solution. }); });
issue: if countdown finished (e.g. 00:00:00:00 ) page reload occur twice when script loaded @ first time,
i have used localstorage concept unable find exact solution. please
i had issue page reloading instantly. try , check if local time , server time same. in case, difference 2 hours, issue put page constant loop. countdown plugin has notes on timezone awareness: http://hilios.github.io/jquery.countdown/examples/timezone-aware.html
Comments
Post a Comment