Display picture when timer completes!
I'm having difficulties with the following bit of code. I can get the "picture" and timer function working fine separately, but am having trouble combining the codes into one function. See below:
var seconds = 15;
var minutes = 0;
var secondPassed = function(){
Appery("timer_div").text(minutes + " : " + seconds);
{seconds--;
if (seconds === 0){
if (minutes === 0){
var picture = function () {
clearInterval(countdownTimer);
Appery("timer_div").text("timer done!");
getRandomInt(min, max);
return Math.floor(Math.random() * (max - min)) + min; };
var randNum = getRandomInt(0,10);
var imageUrl = Appery.getImagePath("img_" + randNum + ".png");
Apperyio("mobileimage_27").attr("src", imageUrl); }
else {seconds = 60;
minutes--;}}
var countdownTimer = setInterval(secondPassed, 1000);
secondPassed();
Can someone please advise what I'm doing incorrect??
Also, when I click the timer button twice, the timer is running two different times.... any idea how to prevent this?
thanks in advance for any help!!!