Problem re-factoring multiple timer countdown
- by jowan
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