Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically change the countdown #12

Open
stevember opened this issue Jun 21, 2015 · 6 comments
Open

Dynamically change the countdown #12

stevember opened this issue Jun 21, 2015 · 6 comments

Comments

@stevember
Copy link

Hi,

Is it possible to dynamically change the countdown with any of the options?

I have a countdown that starts at 19 seconds when it runs out it fades the box. But I need to change that countdown to anything from 5 seconds to 30 seconds and whenever I do it still fades the box with the original countdown.

@KrzysiekF
Copy link
Owner

Hello,
Try change attribute data-time and after that once again init plugin.

@stevember
Copy link
Author

Thank you for the reply. I have tried that, it does update counter but the original one still counts down and when it expires fades the box. Example, box has 30 seconds timer with only 10 seconds to go I reset the counter to 25 seconds but the box still fades in 10 seconds. I hope that makes sense.

Also, thank you for the timer I'm using it throughout my site and it does not have the bug other popular timers have that basically trashes the CPU in chrome. Or it does on my computer anyway.

@stevember
Copy link
Author

My code after playing loads. I'm badly self taught.

 function protectExp(){
   $('#protectDiv').removeClass('hot');             
 }
  function ProtectUpdate2(ti){

        if(ti > 0){
            $('#protectDiv').addClass('hot');           
            $('#protectTimerOut').html('<strong id="protectTimer" data-seconds="' = ti + '"></strong>');            
            $('#protectTimer').trigger('countdown:reset');
            $('#protectTimer').kkcountdown({ callback : protectExp });
        }

}
<span id="protectTimerOut"><span  id="protectTimer"></span></span>

@ivok
Copy link

ivok commented Jul 6, 2017

@KrzysiekF I have same issue as @stevember

@stevember
Copy link
Author

I couldn't solve it in the end, if my memory recalls correctly.

I ended up using this timer http://keith-wood.name/countdown.html

@ivok
Copy link

ivok commented Jul 6, 2017

@stevember thanks. I will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants