Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

how to count down a timer mm:ss

$
0
0

hello

i found this but i dont know how to work how to count it down like

00:60

00:59

00:58

 

 

var formatSeconds = function(secs){

    var pad = function(n) {

        return (n < 10 ? "0" + n : n);

    };

 

    var h = Math.floor(secs / 3600);

    var m = Math.floor((secs / 3600) % 1 * 60); // Remainder of an hour of seconds x 60

    var s = Math.floor((secs / 60) % 1 * 60); // Remainder of a minute of seconds x 60

 

    return pad(h) +":"+ pad(m) +":"+ pad(s);

};

 

 

var counter = setInterval(timer, 500);

 

 

s = formatSeconds(60);

 

 

 

function timer() {

 

s--;

 

sym.$("Text").html(s); //return Nan error

 

 

}


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>