I'm using Timecircles to build a simple quiz. Inside the "click" function I use .getTime() to get the actual time it took for the user to pick an answare.
However, I would like to "autoclick" (trigger the click-action) if the value of the time is 0. In order to move on to next question and set the number of points etc.
$(".countdown").TimeCircles({
count_past_zero: false,
total_duration: 15
}).addListener(function(unit,value,total) {
if(value == 0){
alert ('GAME OVER!');
//Trigger the click event here
}
});
$('#quiz-container').on('click', '.my_button', function() {
var t = $(".countdown").TimeCircles().getTime();
//Quiz logic here
// Load new question and reset timer
var t = $(".countdown").TimeCircles().reset();
});
I can not place the click-function in the actual addlistener as I need to refresh it for each new question.
Use trigger like
or the shorthand form
So, you will have