Reputation: 397
var clock;
// Instantiate a counter
clock = new FlipClock($('.clock'), 10, {
clockFace: 'MinuteCounter',
autoStart: false,
countdown: true
});
var time = clock.getFaceValue();
How do you get the current face value of the flip clock, as it continuously countdown. I've tried using getTime() and a number of different functions that are defined in their java script file. I don't understand how to achieve this.
Upvotes: -4
Views: 1068
Reputation: 75
You should be able to get the time/counter value. If you are querying outside of the callbacks, then simply:
clock.getTime().time
Try it out in the browser console first. The documentation in this part is really confusing. I guess this plugin hasn't been updated since 5 years ago.
Upvotes: 0
Reputation: 5208
var clock;
$(document).ready(function() {
clock = new FlipClock($('.clock'), 10, {
clockFace: 'Counter',
autoStart: true,
countdown: true,
callbacks: {
interval: function() {
var time = this.factory.getTime().time;
if (time) {
console.log(time);
}
}
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flipclock/0.7.8/flipclock.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flipclock/0.7.8/flipclock.min.css" rel="stylesheet" />
<div class="clock"></div>
Upvotes: 0