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

Countdown as a progress bar #328

Open
sunugur opened this issue Aug 30, 2020 · 1 comment
Open

Countdown as a progress bar #328

sunugur opened this issue Aug 30, 2020 · 1 comment

Comments

@sunugur
Copy link

sunugur commented Aug 30, 2020

I would like to show the countdown as a progress bar instead of time left?

Searched the site on how to to do it but could not find a way to do it, any help would be appreciated

@webwamp
Copy link

webwamp commented Sep 1, 2020

hi @sunugur that to easy. set countdown and on update get total seconds and just divide on main total seconds and multiplication 100 finally you get percentage passed time and you can used for show progress or else, as example:

`var mainTotalSeconds = 600; // 10 min

/* inside countdown on update function : */

var passedTotalSeconds = parseInt(e.strftime("%S")); // for example return : 450

var percentage = ( passedTotalSeconds / mainTotalSeconds ) * 100; // example result is : 75
$(".progress-bar").css("width",percentage + "%"); // 75% filled now and be less

// or if you want filled progress bar by passing time you should do this:

var percentage = 100 - ( ( passedTotalSeconds / mainTotalSeconds ) * 100 ); // example result is : 25
$(".progress-bar").css("width",percentage + "%"); // 25% filled now and be more
`

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

2 participants