Search code examples
jquerytimercountdownprogress

Jquery countdown progress bar for a coming soon page


I'm looking for a animated jQuery progress bar, horizontal and/or vertical.

Free or commercial one.

The idea is to set the start and end date something like:

var startDate = new Date();
var endDate = new Date("September 28, 2014")); // deadline

and the progress bar should show in percent the current status like "we are at 20%" till the end date.

The progress bar should be animated (on each refresh) from 0 - current status, for e.g. 20%.

Can anyone help me with this? Thanks in advance.


Solution

  • Hints :

    you should be able to calculate the difference between two dates using this code :

    var diff = Math.abs(new Date() - new Date(dateStr.replace(/-/g,'/')));
    

    and the date should be in numbers. Then you should calculates the difference between the creation date of the page :

    var Vdiff = Math.abs(new new Date(beginningdateStr.replace(/-/g,'/')) - new Date(dateStr.replace(/-/g,'/')));
    

    then progressbar value should be equal to (diff*100)/Vdiff