I'm working with jQuery Flipclock
It's working good.
Then now I have button modify time, if I click it then the time will be change to 10 seconds and print the text into span info. But why the old counting value is still appear? How to print into span info only 10 seconds (on button click) without show the old counting value?.
$('.modifytime').on('click', function() {
countdown(10);
});
function countdown(b) {
if (b == undefined) {
a = 15;
} else {
a = 10
}
clock = $('.clock').FlipClock(a, {
clockFace: 'MinuteCounter',
countdown: true,
autoStart: true,
callbacks: {
start: function() {
$('.message').html('The clock has started!');
},
interval: function() {
var time = this.factory.getTime().time;
$('.info').html(time);
},
stop: function(){
alert("Counting done");
}
}
});
}
countdown();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="https://kms.puksiix.com/flipclock.css" rel="stylesheet" />
<script src="https://kms.puksiix.com/flipclock.js"></script>
<div class="clock"></div>
<span class="info"></span>
<button class="modifytime">Modify</button>
UPDATED If I put this script:
stop: function(){
alert("Counting done");
}
It always show me "Counting done" even I just click the button.