开发者

How to use jQuery Countdown Plugin functions

开发者 https://www.devze.com 2023-01-19 14:57 出处:网络
I am working on this piece of code using the jQuery Countdown Plugin it works but how ever if i try using a function with \" function showPauseTime ()\" I keep getting an error showPauseTime undefined

I am working on this piece of code using the jQuery Countdown Plugin it works but how ever if i try using a function with " function showPauseTime ()" I keep getting an error showPauseTime undefined.

Can any body take a look at the code and tell me how I could solve this thanks

$('#beginExercise').click(function() {
    //check if terms checkbox is checked before stating timer                              
    if($('#terms').is(':checked')){ 

            $("#pauseButton").show();

            //start time at zero
            $("#elapsTimer").countdown({since: 0,onTick:showPauseTime});

             //Allow the Elaps Timer to be paused
            $('#pauseButton').toggle(function() { 
                    $(this).text('Resume Exercise'); 
                    $('#elapsTimer').countdown('pause'); 
                }, 
                function() { 
                    $(this).text('Pause Exercise'); 
                    $('#elapsTimer').countdown('resume'); 
            }); 

            function showPauseTime(periods) { 
                $('#showPauseTime').text(periods[4] + ':' + twoDigits(periods[5]) + 
                    ':' + twoDigits(periods[6])); 
            }
开发者_高级运维
     } //end if         
});


Can you just keep the function : showPauseTime(periods){...} outside of the 'Click' event and then try again?

Also the function is expecting a parameter : periods, which was not supplied in the function call, i guess.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号