Skip to content

Instantly share code, notes, and snippets.

@caike
Last active October 1, 2019 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caike/dbc87c5816ec93b2b4797b245a6cb67f to your computer and use it in GitHub Desktop.
Save caike/dbc87c5816ec93b2b4797b245a6cb67f to your computer and use it in GitHub Desktop.
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