Problem re-factoring multiple timer countdown
Posted
by
jowan
on Pro Webmasters
See other posts from Pro Webmasters
or by jowan
Published on 2011-01-13T01:59:27Z
Indexed on
2011/01/13
2:59 UTC
Read the original article
Hit count: 245
jQuery
I create my multiple timer countdown from easy or simple script. entire code
The problem's happen when i want to add timer countdown again
i have to declare variable current_total_second
CODE:
elapsed_seconds= tampilkan("#time1");
and variable timer who set with setInterval..
timer= setInterval(function() {
if (elapsed_seconds != 0){
elapsed_seconds = elapsed_seconds - 1;
$('#time1').text(get_elapsed_time_string(elapsed_seconds))
}else{
$('#time1').parent().slideUp('slow', function(){
$(this).find('.post').text("Post has been deleted");
})
$('#time1').parent().slideDown('slow');
clearInterval(timer);
}
}, 1000);
i've already know about re-factoring and try different way but i'm stack to re-factoring this code i want implement flexibelity to it.. when i add more of timer countdown.. script do it automatically or dynamically without i have to add a bunch of code.. and the code become clear and more efficient..
Thanks in Advance
© Pro Webmasters or respective owner