FinalCountdown.js stop event handler not working

93
March 13, 2018, at 5:31 PM

i am using the adminLTE template and within that I have a FinalCountdown.js timer as follows:

http://hilios.github.io/jQuery.countdown/
                    $('#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.

READ ALSO
.addClass() jQuery how to specify the CSS

.addClass() jQuery how to specify the CSS

I have a div and I want to put a display none when I click on itI am using bootstrap4 and It has a css style called "d-none" that put display none to an element

81
Strange bug. Javascript, , Trying to run a loop, but getting a blank error in Chrome console

Strange bug. Javascript, , Trying to run a loop, but getting a blank error in Chrome console

I'm running a loop on an array received from an obj {message:Array(22)} ajax callYou can see the array has length = 22

72
jquery Nestable is not scrolling while list is long

jquery Nestable is not scrolling while list is long

I'm using Nestablejs for drag/drop I'm displaying that list (on which drag/drop required) in a modal(bootstrap modal), Everything is working fine for me, the issue is when list (within

73
How to set input data-toggle for a link in bootstrap?

How to set input data-toggle for a link in bootstrap?

I have a link and I want to set a bootstrap toggle for it :

77