The issue I am having is that the stop event handler is not working. I am able to stop the timer from another JavaScript function. What I am really looking for is to determine how much time is left when the timer is stopped.
Any help will be highly appreciated.
$('#clock').countdown(finalDate, { defer: true }).on('update.countdown', function (event) {
if (TestScore == TotalScore) {
$("#clock").countdown('stop');
ShowTestFinishModal();
}
else {
var format = '%M:%S';
if (event.offset.totalDays > 0) {
format = '%-d day%!d ' + format;
}
if (event.offset.weeks > 0) {
format = '%-w week%!w ' + format;
}
$(this).html(event.strftime(format));
};
}).on('finish.countdown', function (event) {
IsTestAvailable = false;
SaveBlockTestScores();
if (TestScore == TotalScore) {
$("#clock").countdown('stop');
ShowTestFinishModal();
}
else {
$("#messageModal-title").empty();
$("#messageModal-body").empty();
$("#messageModal-title").append("<h1>Test over</h1>");
$("#messageModal-body").append("<h2>You scrore is " + TestScore + ". Please practice assigned cases again and reattempt this test.</h2>");
$("#messageModal").modal('show');
}
}).on('countdown.stop', function () {
alert('h');
}).countdown('start');
The issue I am having is that the stop event handler is not working. I am able to stop the timer from another JavaScript function. What I am really looking for is to determine how much time is left when the timer is stopped.
Any help will be highly appreciated.