Skip to content

Instantly share code, notes, and snippets.

@caike caike/timer.js
Last active Oct 1, 2019

Embed
What would you like to do?
Example of updating timer on the fly
$(function() {
const timer = $('.timer');
timer.startTimer({ allowPause: true });
setTimeout(() => {
timer.trigger('click');
timer.data('timeLeft', 30);
timer.trigger('click');
}, 3000);
});
/*
* Try this with a <h1 class="timer" data-seconds-left="55"></h1> for example,
* and you should see it updating to 30 seconds at the 52 second mark
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.